修改三维驾驶根据列车节数动态更新位置

This commit is contained in:
sunzhenyu 2020-12-17 17:49:25 +08:00
parent 3534abb5ff
commit bfa396be54

View File

@ -361,7 +361,7 @@ export function Jl3dDrivingNew(mixers,updatemmi,sound,translation,routegroup,dri
updateTrainModel.rotation.y = Math.PI;
let point = updateTrainModel.curve.getPointAt(data.offset);
updateTrainModel.position.x = point.x;
for (let tl=0; tl<6; tl++) {
for (let tl=0; tl<updateTrainModel.children.length; tl++) {
updateTrainModel.children[tl].position.z = point.z;
}
}else{
@ -369,7 +369,7 @@ export function Jl3dDrivingNew(mixers,updatemmi,sound,translation,routegroup,dri
updateTrainModel.rotation.y = 0;
let point = updateTrainModel.curve.getPointAt(data.offset);
updateTrainModel.position.x = point.x;
for (let tl=0; tl<6; tl++) {
for (let tl=0; tl<updateTrainModel.children.length; tl++) {
updateTrainModel.children[tl].position.z = point.z;
}
}
@ -413,7 +413,7 @@ export function Jl3dDrivingNew(mixers,updatemmi,sound,translation,routegroup,dri
for(let xh=0;xh<updateTrainModel.children[rs].rotalist.length;xh++){
if((updateTrainModel.children[rs].matrixWorld.elements[12]+10)>=updateTrainModel.children[rs].rotalist[0].posr.x){
if(rs != 5){
if(rs != updateTrainModel.children.length-1){
let asd = updateTrainModel.children[rs].rotalist[0];
updateTrainModel.children[rs+1].rotalist.push(asd);
@ -488,7 +488,7 @@ export function Jl3dDrivingNew(mixers,updatemmi,sound,translation,routegroup,dri
for(let xh=0;xh<updateTrainModel.children[rs].rotalist.length;xh++){
if((updateTrainModel.children[rs].matrixWorld.elements[12]-10)<=updateTrainModel.children[rs].rotalist[0].posr.x){
if(rs != 5){
if(rs != updateTrainModel.children.length-1){
let asd = updateTrainModel.children[rs].rotalist[0];
updateTrainModel.children[rs+1].rotalist.push(asd);
@ -537,7 +537,7 @@ export function Jl3dDrivingNew(mixers,updatemmi,sound,translation,routegroup,dri
trainmodel.rotation.y = Math.PI;
let point = trainmodel.curve.getPointAt(data.offset);
trainmodel.position.x = point.x;
for (let tl=0; tl<6; tl++) {
for (let tl=0; tl<trainmodel.children.length; tl++) {
trainmodel.children[tl].position.z = point.z;
}
@ -572,7 +572,7 @@ export function Jl3dDrivingNew(mixers,updatemmi,sound,translation,routegroup,dri
trainmodel.rotation.y = 0;
let point = trainmodel.curve.getPointAt(data.offset);
trainmodel.position.x = point.x;
for (let tl=0; tl<6; tl++) {
for (let tl=0; tl<trainmodel.children.length; tl++) {
trainmodel.children[tl].position.z = point.z;
}
@ -639,7 +639,7 @@ export function Jl3dDrivingNew(mixers,updatemmi,sound,translation,routegroup,dri
}
if(trainmodel.children[1].rotalist.length > 0 || trainmodel.children[2].rotalist.length > 0 || trainmodel.children[3].rotalist.length > 0 || trainmodel.children[4].rotalist.length > 0|| trainmodel.children[5].rotalist.length > 0){
for(let rs = 1;rs<6;rs++){
for(let rs = 1;rs<trainmodel.children.length;rs++){
//console.log(rs);
if(trainmodel.children[rs].rotalist[0]){
@ -652,7 +652,7 @@ export function Jl3dDrivingNew(mixers,updatemmi,sound,translation,routegroup,dri
for(let xh=0;xh<trainmodel.children[rs].rotalist.length;xh++){
if((trainmodel.children[rs].matrixWorld.elements[12]+10)>=trainmodel.children[rs].rotalist[0].posr.x){
if(rs != 5){
if(rs != trainmodel.children.length-1){
let asd = trainmodel.children[rs].rotalist[0];
trainmodel.children[rs+1].rotalist.push(asd);
@ -749,7 +749,7 @@ export function Jl3dDrivingNew(mixers,updatemmi,sound,translation,routegroup,dri
if(trainmodel.children[1].rotalist.length > 0 || trainmodel.children[2].rotalist.length > 0 || trainmodel.children[3].rotalist.length > 0 || trainmodel.children[4].rotalist.length > 0|| trainmodel.children[5].rotalist.length > 0){
for(let rs = 1;rs<6;rs++){
for(let rs = 1;rs<trainmodel.children.length;rs++){
//console.log(rs);
if(trainmodel.children[rs].rotalist[0]){
let offsetz = parseFloat(trainmodel.children[rs].rotalist[0].posr.z) - parseFloat(trainmodel.children[rs].matrixWorld.elements[14]);
@ -761,7 +761,7 @@ export function Jl3dDrivingNew(mixers,updatemmi,sound,translation,routegroup,dri
for(let xh=0;xh<trainmodel.children[rs].rotalist.length;xh++){
if((trainmodel.children[rs].matrixWorld.elements[12]-10)<=trainmodel.children[rs].rotalist[0].posr.x){
if(rs != 5){
if(rs != trainmodel.children.length-1){
let asd = trainmodel.children[rs].rotalist[0];
trainmodel.children[rs+1].rotalist.push(asd);