修改驾驶中相机对象引用错误

This commit is contained in:
sunzhenyu 2019-08-29 11:04:10 +08:00
parent ddb608d7e7
commit 06c29a97c4
4 changed files with 51 additions and 52 deletions

View File

@ -57,7 +57,7 @@ export function JLmapDriving(dom, data, skinCode) {
document.getElementById('jlsimulation').appendChild(renderer.domElement);
document.getElementById('jlcctv').appendChild(renderercctv.domElement);
// 定义相机
let camera = SetCamera(dom);
//let camera = SetCamera(dom);
// 定义场景(渲染容器)
const scene = SetScene();
@ -95,24 +95,22 @@ export function JLmapDriving(dom, data, skinCode) {
// 地图模型数据
let mapdata = new Jl3ddata();
const camera2 = new THREE.PerspectiveCamera( 60, window.innerWidth / window.innerHeight, 1, 1100 );
camera2.name = 'camera2';
let camera = new THREE.PerspectiveCamera(70, dom.clientWidth/dom.clientHeight, 1, 1100);
camera.position.set( 0, 0, 0 );
camera.aspect = window.innerWidth / window.innerHeight;
camera.updateProjectionMatrix();
const controls3 = new MouseControls(camera2, 1.6);
const controls3 = new MouseControls(camera, 1.6);
controls3.enabled = true;
scene.add(controls3.getObject());
let cameracctv = new THREE.PerspectiveCamera(70, dom.clientWidth/dom.clientHeight, 1, 50);
let cameracctv = new THREE.PerspectiveCamera(70, dom.clientWidth/dom.clientHeight, 1, 150);
cameracctv.position.set( 5, -3,27 );
cameracctv.rotation.y = Math.PI/2;
camera2.add(cameracctv);
cameracctv.rotation.y = Math.PI/5*3;
camera.add(cameracctv);
// 订阅仿真socket
this.Subscribe = new Jl3dDriving(scope);
// 连接到通信
// console.log(this.Subscribe.config);
// this.webwork.postMessage(this.Subscribe.teststomp);
this.Subscribe.socketon(scope.Subscribe.topic);
@ -137,7 +135,7 @@ export function JLmapDriving(dom, data, skinCode) {
// 判断渲染是否开启
if (scope.animateswitch == true) {
// 根据相机渲染场景
renderer.render(scene, camera2);
renderer.render(scene, camera);
renderercctv.render(scene,cameracctv);
// updatcontrols();
// renderercctv

View File

@ -213,47 +213,48 @@ export function Jl3dDriving(jlmap3d) {
}
trainlisttest.list[code].runMode = data.body[i].runMode;
// 车门开关验证
if (data.body[i].directionType == '02') {
if (trainlisttest.list[code].doorStatus != data.body[i].doorStatus && data.body[i].doorStatus == '01') {
// console.log("close");
trainlisttest.list[code].doorStatus = '01';
for (let an=actions[code].top.length-1; an>=0; an--) {
actions[code].top[an].reset();
actions[code].top[an].time = actions[code].top[an]._clip.duration;
actions[code].top[an].timeScale = -1;
actions[code].top[an].play();
}
} else if (trainlisttest.list[code].doorStatus != data.body[i].doorStatus && data.body[i].doorStatus == '02') {
// console.log("open");
trainlisttest.list[code].doorStatus = '02';
for (let an=actions[code].top.length-1; an>=0; an--) {
actions[code].top[an].reset();
actions[code].top[an].time = 0;
actions[code].top[an].timeScale = 1;
actions[code].top[an].play();
}
if (trainlisttest.list[code].doorStatus != data.body[i].doorStatus && data.body[i].doorStatus == '01') {
// console.log("close");
trainlisttest.list[code].doorStatus = '01';
for (let an=actions[code].top.length-1; an>=0; an--) {
actions[code].top[an].reset();
actions[code].top[an].time = actions[code].top[an]._clip.duration;
actions[code].top[an].timeScale = -1;
actions[code].top[an].play();
}
} else {
if (trainlisttest.list[code].doorStatus != data.body[i].doorStatus && data.body[i].doorStatus == '01') {
// console.log("close");
trainlisttest.list[code].doorStatus = '01';
for (let an=actions[code].down.length-1; an>=0; an--) {
actions[code].down[an].reset();
actions[code].down[an].time = actions[code].top[an]._clip.duration;
actions[code].down[an].timeScale = -1;
actions[code].down[an].play();
}
} else if (trainlisttest.list[code].doorStatus != data.body[i].doorStatus && data.body[i].doorStatus == '02') {
// console.log("open");
trainlisttest.list[code].doorStatus = '02';
for (let an=actions[code].down.length-1; an>=0; an--) {
actions[code].down[an].reset();
actions[code].down[an].time = 0;
actions[code].down[an].timeScale = 1;
actions[code].down[an].play();
}
} else if (trainlisttest.list[code].doorStatus != data.body[i].doorStatus && data.body[i].doorStatus == '02') {
// console.log("open");
trainlisttest.list[code].doorStatus = '02';
for (let an=actions[code].top.length-1; an>=0; an--) {
actions[code].top[an].reset();
actions[code].top[an].time = 0;
actions[code].top[an].timeScale = 1;
actions[code].top[an].play();
}
}
// if (data.body[i].directionType == '02') {
//
// } else {
// if (trainlisttest.list[code].doorStatus != data.body[i].doorStatus && data.body[i].doorStatus == '01') {
// // console.log("close");
// trainlisttest.list[code].doorStatus = '01';
// for (let an=actions[code].down.length-1; an>=0; an--) {
// actions[code].down[an].reset();
// actions[code].down[an].time = actions[code].top[an]._clip.duration;
// actions[code].down[an].timeScale = -1;
// actions[code].down[an].play();
// }
// } else if (trainlisttest.list[code].doorStatus != data.body[i].doorStatus && data.body[i].doorStatus == '02') {
// // console.log("open");
// trainlisttest.list[code].doorStatus = '02';
// for (let an=actions[code].down.length-1; an>=0; an--) {
// actions[code].down[an].reset();
// actions[code].down[an].time = 0;
// actions[code].down[an].timeScale = 1;
// actions[code].down[an].play();
// }
// }
// }
// 遍历获取所在轨道
if (trainlisttest.list[code].dispose != data.body[i].dispose && data.body[i].dispose == false) {

View File

@ -3,8 +3,8 @@ export function getBaseUrl() {
let BASE_API;
if (process.env.NODE_ENV === 'development') {
// BASE_API = 'https://joylink.club/jlcloud';
// BASE_API = 'https://test.joylink.club/jlcloud';
BASE_API = 'http://192.168.3.5:9000'; // 袁琪
BASE_API = 'https://test.joylink.club/jlcloud';
// BASE_API = 'http://192.168.3.5:9000'; // 袁琪
// BASE_API = 'http://192.168.3.6:9000'; // 旭强
// BASE_API = 'http://192.168.3.4:9000' // 琰培
} else {

Binary file not shown.