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

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"
},//"https://joylink.club/oss/wx/switch/switch.FBX"
//../../static/model/device/switch.FBX
station: {
man2: {
id: "2",
name: "人物2",
deviceType: "man",
type: "man",
picUrl: "",
assetUrl: "../../static/model/passflow/man2.FBX"
},
station: {
id: "3",
name: "车站",
deviceType: "station",
type: "hrb",

View File

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

View File

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

View File

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

Binary file not shown.