修改三维仿真停车点

This commit is contained in:
sunleking 2020-03-08 23:10:57 +08:00
parent a64e2e0880
commit a87d551751
5 changed files with 44 additions and 6 deletions

View File

@ -137,6 +137,10 @@ export function Jlmap3dSubscribeNew(jlmap3d,routegroup,jsonwebwork) {
if (data.right == '1') { // 向右
trainlisttest.list[code].progress = data.offset;
trainlisttest.list[code].isstandsection = rails.sectionrail[data.section].standTrack;
if(rails.sectionrail[data.section].standTrack){
trainlisttest.list[code].statsstop = 0;
}
let point = rails.sectionrail[data.section].lineleft.getPointAt(trainlisttest.list[code].progress);
trainlisttest.list[code].rotation.y = 0;
trainlisttest.list[code].position.x = point.x;
@ -157,6 +161,10 @@ export function Jlmap3dSubscribeNew(jlmap3d,routegroup,jsonwebwork) {
} else if (data.right == '0') { // 向左
trainlisttest.list[code].progress = 1-data.offset;
trainlisttest.list[code].isstandsection = rails.sectionrail[data.section].standTrack;
if(rails.sectionrail[data.section].standTrack){
trainlisttest.list[code].statsstop = 0;
}
let point = rails.sectionrail[data.section].lineright.getPointAt(trainlisttest.list[code].progress);
trainlisttest.list[code].rotation.y = Math.PI;
@ -186,19 +194,20 @@ export function Jlmap3dSubscribeNew(jlmap3d,routegroup,jsonwebwork) {
trainlisttest.list[code].nextcode = data.next;
trainlisttest.list[code].nextcurve = rails.sectionrail[data.next].lineleft;
trainlisttest.list[code].nextlen = rails.sectionrail[data.next].lengthfact;
trainlisttest.list[code].nextissection = rails.sectionrail[data.next].standTrack;
} else if (data.right == '0') { // 向左
trainlisttest.list[code].nextcode = data.next;
trainlisttest.list[code].nextcurve = rails.sectionrail[data.next].lineright;
trainlisttest.list[code].nextlen = rails.sectionrail[data.next].lengthfact;
trainlisttest.list[code].nextissection = rails.sectionrail[data.next].standTrack;
}
}
}
if(data.speed == 0){
trainlisttest.list[code].speeds = data.speed;
trainlisttest.list[code].speeds = 0;
trainlisttest.list[code].statsstop = 0;
}else{
// console.log(data.speed);
// console.log(trainlisttest.list[code]);

View File

@ -67,7 +67,15 @@ export function UpdateTrainNew(camera,traindata){
}
}
}
trainmodel.progress += trainmodel.speeds;
if(trainmodel.statsstop == 0){
if((1-trainmodel.progress) > 0.95){
trainmodel.progress += trainmodel.speeds;
}
}else{
trainmodel.progress += trainmodel.speeds;
}
}
@ -119,7 +127,13 @@ export function UpdateTrainNew(camera,traindata){
}
}
}
trainmodel.progress += trainmodel.speeds;
if(trainmodel.statsstop == 0){
if(trainmodel.progress < 0.95){
trainmodel.progress += trainmodel.speeds;
}
}else{
trainmodel.progress += trainmodel.speeds;
}
}
@ -129,7 +143,14 @@ export function UpdateTrainNew(camera,traindata){
trainmodel.len = trainmodel.nextlen;
if(trainmodel.nextcode){
trainmodel.nowcode = trainmodel.nextcode;
trainmodel.isstandsection = trainmodel.nextissection;
if(trainmodel.isstandsection){
trainmodel.statsstop = 0;
}else{
trainmodel.statsstop = 1;
}
}
trainmodel.speeds = parseFloat(trainmodel.speed*10/36/25/trainmodel.len);
trainmodel.curve = trainmodel.nextcurve;
trainmodel.nextcurve = null;

View File

@ -145,6 +145,7 @@ export function RailListN(){
//
for(let i=0;i<section.length;i++){
scope.sectionrail[section[i].code].lineleft = new THREE.CatmullRomCurve3(scope.sectionrail[section[i].code].points);
scope.sectionrail[section[i].code].lineleft.curveType = "centripetal";
// scope.sectionrail[section[i].code].lineleft.tension = 0.2;
@ -156,6 +157,12 @@ export function RailListN(){
rightpoints.reverse();
scope.sectionrail[section[i].code].lineright = new THREE.CatmullRomCurve3(rightpoints);
scope.sectionrail[section[i].code].lineright.curveType = "centripetal";
if(section[i].standTrack == true){
scope.sectionrail[section[i].code].standTrack = true;
}else{
scope.sectionrail[section[i].code].standTrack = false;
}
//
// for(let n=0,nm=scope.sectionrail[section[i].code].lineleft.points.length;n<nm;n++){
// var geometry = new THREE.CircleGeometry( 0.05, 16 );

View File

@ -182,6 +182,7 @@ export function TrainListN() {
newmesh.speeds = 0;
newmesh.progress = null;
newmesh.startmark = 0;
newmesh.statsstop = 0;
scope.list[data[i].code] = newmesh;

View File

@ -698,7 +698,7 @@ function timedCount(){
function callback(Response) {
data = JSON.parse(Response.body);
console.log(data);
// console.log(data);
if(data.type == 'TrainRun_3D'){
for (let i=0,leni = data.body.length; i<leni; i++) {
data.body[i].type = "TRAIN";