三维客流视图追加人物模型动画

This commit is contained in:
sunleking 2020-02-18 17:55:29 +08:00
parent 9babb6e9a2
commit 338f9a75e8
5 changed files with 42 additions and 33 deletions

View File

@ -8,8 +8,16 @@ var Staticmodel = {
assetUrl: "../../static/model/passflow/man1.FBX" assetUrl: "../../static/model/passflow/man1.FBX"
},//"https://joylink.club/oss/wx/switch/switch.FBX" },//"https://joylink.club/oss/wx/switch/switch.FBX"
//../../static/model/device/switch.FBX //../../static/model/device/switch.FBX
station: { man2: {
id: "2", id: "2",
name: "人物2",
deviceType: "man",
type: "man",
picUrl: "",
assetUrl: "../../static/model/passflow/man2.FBX"
},
station: {
id: "3",
name: "车站", name: "车站",
deviceType: "station", deviceType: "station",
type: "hrb", type: "hrb",

View File

@ -17,8 +17,10 @@ var checkdoor2 = [];
var station; var station;
let ids = 0; let ids = 0;
var rungroup = new THREE.Group(); var rungroup = new THREE.Group();
let originhuman = null; let originhuman1 = null;
let originanima = null; let originhuman2 = null;
let originanima1 = null;
let originanima2 = null;
let moveanimatelist = []; let moveanimatelist = [];
let zhajiin = []; let zhajiin = [];
@ -183,17 +185,20 @@ export function Jl3dpassflow(dom) {
console.log(scope.modelmanager); console.log(scope.modelmanager);
station = scope.modelmanager.station.mesh; station = scope.modelmanager.station.mesh;
scope.scene.add(station); scope.scene.add(station);
originhuman = scope.modelmanager.man1.mesh; originhuman1 = scope.modelmanager.man1.mesh;
let mixer = new THREE.AnimationMixer( originhuman ); originhuman2 = scope.modelmanager.man2.mesh;
originanima = originhuman.animations[ 0 ]; let mixer1 = new THREE.AnimationMixer( originhuman1 );
originhuman.remove(originhuman.children[2]); let mixer2 = new THREE.AnimationMixer( originhuman2 );
originanima1 = originhuman1.animations[ 0 ];
originanima2 = originhuman2.animations[ 0 ];
originhuman1.remove(originhuman1.children[2]);
scope.scene.add(rungroup); scope.scene.add(rungroup);
animate(); animate();
}) })
let checkobject = setInterval(function(){ let checkobject = setInterval(function(){
// console.log(originhuman); // console.log(originhuman1);
if(originhuman){ if(originhuman1){
console.log("start"); console.log("start");
clearInterval(checkobject); clearInterval(checkobject);
//进站控制 //进站控制
@ -203,7 +208,6 @@ export function Jl3dpassflow(dom) {
if(humans){ if(humans){
if(humans.length<500){ if(humans.length<500){
newhumancreate(); newhumancreate();
} }
// console.log(humans.length); // console.log(humans.length);
for(let i=0;i<humans.length;i++){ for(let i=0;i<humans.length;i++){
@ -468,11 +472,19 @@ export function Jl3dpassflow(dom) {
function newhumancreate(){ function newhumancreate(){
var direct = Math.floor(Math.random()*(3-1+1))+1; var direct = Math.floor(Math.random()*(3-1+1))+1;
var mantype = Math.floor(Math.random()*(3-1+1))+1;
// console.log(direct); // console.log(direct);
let points = []; let points = [];
let newhuman;
if(mantype == 1){
let newhuman = THREE.SkeletonUtils.clone( originhuman ); newhuman = THREE.SkeletonUtils.clone( originhuman1 );
newhuman.animations = [];
newhuman.animations.push(originanima1.clone());
}else{
newhuman = THREE.SkeletonUtils.clone( originhuman2 );
newhuman.animations = [];
newhuman.animations.push(originanima2.clone());
}
if(direct == 1|| direct == 2){ if(direct == 1|| direct == 2){
newhuman.position.set(32,10,25); newhuman.position.set(32,10,25);
points.push(new THREE.Vector3(32,10,25)); points.push(new THREE.Vector3(32,10,25));
@ -486,30 +498,13 @@ export function Jl3dpassflow(dom) {
points.push(new THREE.Vector3(18,10,18)); points.push(new THREE.Vector3(18,10,18));
} }
// if(direct == 3){
// newhuman.position.set(-43,10,25);
// }
// if(direct == 4){
// newhuman.position.set(-42,10,-5);
// }
newhuman.animations = [];
newhuman.animations.push(originanima.clone());
// let mixer = new THREE.AnimationMixer( newhuman );
// mixers.push(mixer);
// let action = mixer.clipAction( newhuman.animations[ 0 ] );
// action.setLoop(THREE.LoopOnce);
// action.clampWhenFinished = true;
// action.loop = THREE.LoopOnce ;
//
// console.log(newhuman);
let mixer = new THREE.AnimationMixer( newhuman ); let mixer = new THREE.AnimationMixer( newhuman );
mixer.runplay = false; mixer.runplay = false;
let action = mixer.clipAction( newhuman.animations[ 0 ] ); let action = mixer.clipAction( newhuman.animations[ 0 ] );
var stationdirection = Math.floor(Math.random()*(2-1+1))+1; var stationdirection = Math.floor(Math.random()*(2-1+1))+1;
// action.setLoop(THREE.LoopOnce);
// action.clampWhenFinished = true;
// action.loop = THREE.LoopOnce ;
let newone = { let newone = {
id:humans.length, id:humans.length,
mesh:newhuman, mesh:newhuman,

View File

@ -9,6 +9,12 @@ export function ModelManager(){
mesh:null, mesh:null,
action:null action:null
}; };
this.man2 = {
code:null,
locateType:"01",
mesh:null,
action:null
};
this.station = { this.station = {
@ -21,6 +27,7 @@ export function ModelManager(){
this.loadpromise = function (data,mixers){ this.loadpromise = function (data,mixers){
let initlist = []; let initlist = [];
initlist.push(fbxpromise(data.man1,mixers,scope.man1)); initlist.push(fbxpromise(data.man1,mixers,scope.man1));
initlist.push(fbxpromise(data.man2,mixers,scope.man2));
initlist.push(fbxpromise(data.station,mixers,scope.station)); initlist.push(fbxpromise(data.station,mixers,scope.station));
return new Promise(function(resolve, reject){ return new Promise(function(resolve, reject){

View File

@ -214,7 +214,6 @@ export default {
}, },
jumpjl3dpassflow(){ jumpjl3dpassflow(){
this.$emit('passflow'); this.$emit('passflow');
console.log("sad");
}, },
jumpjlmap3d() { jumpjlmap3d() {
this.$emit('hidepanel'); this.$emit('hidepanel');

Binary file not shown.