修改三维vr列车模型移动范围贴图,限制vr移动射线范围,修改声音触发

This commit is contained in:
sunzhenyu 2020-10-16 11:34:54 +08:00
parent 9b3ce6f8b7
commit aca48cfbc3
4 changed files with 54 additions and 45 deletions

View File

@ -284,12 +284,7 @@ export function jl3dFaultDeviceVr(dom,group,skinCode) {
let voicetext = scope.nowstation.name.split("");
voiceModel.localVoicePlay("列车即将进站"+voicetext[0]);
if(positionStatus == "topfloor"){
trainControl.sound.pause();
}
if(positionStatus == "downfloor"){
trainControl.sound.pause();
}
vrwebworker.postMessage(stationworket);
vrPlane.updataStationMsg(scope.nowstation);
trainControl.toptrain.position.x = 20000;
@ -326,6 +321,10 @@ export function jl3dFaultDeviceVr(dom,group,skinCode) {
trainControl.closetraindoor(trainControl.toptrain,event.data.doorCode,positionStatus,"top");
// trainLeaveStation("top");
}else{
if(positionStatus == "topfloor"){
trainControl.sound.pause();
}
trainControl.toptrain.position.copy(trainControl.toptrain.curve.getPointAt(0.0365));
trainControl.opentraindoor(trainControl.toptrain,event.data.doorCode,"top");
trainControl.toptrain.status = 1;
@ -338,6 +337,9 @@ export function jl3dFaultDeviceVr(dom,group,skinCode) {
trainControl.closetraindoor(trainControl.downtrain,event.data.doorCode,positionStatus,"down");
// trainLeaveStation("down");
}else{
if(positionStatus == "downfloor"){
trainControl.sound.pause();
}
trainControl.downtrain.position.copy(trainControl.downtrain.curve.getPointAt(0.961));
trainControl.opentraindoor(trainControl.downtrain,event.data.doorCode,"down");
trainControl.downtrain.status = 1;
@ -854,52 +856,55 @@ export function jl3dFaultDeviceVr(dom,group,skinCode) {
if ( intersections) {
// console.log(intersections);
var intersection = intersections[ 0 ];
if(intersection.distance <3.5){
if(positionStatus != intersection.object.name){
positionStatus = intersection.object.name;
if(positionStatus == "dm"){
scope.scene.add(human);
trainControl.sound.pause();
vrwebworker.postMessage("takeStation");
}
if(positionStatus == "topfloor"){
trainControl.toptrain.add(human);
vrwebworker.postMessage("takeTopTrain");
}
if(positionStatus == "downfloor"){
trainControl.downtrain.add(human);
vrwebworker.postMessage("takeDownTrain");
}
}
var object = intersection.object;
if(positionStatus != intersection.object.name){
positionStatus = intersection.object.name;
if(positionStatus == "dm"){
scope.scene.add(human);
vrwebworker.postMessage("takeStation");
human.position.set( intersection.point.x, intersection.point.y+0.6, intersection.point.z );
}
if(positionStatus == "topfloor"){
trainControl.toptrain.add(human);
vrwebworker.postMessage("takeTopTrain");
let posx = intersection.point.x - trainControl.toptrain.position.x;
let posz = intersection.point.z - trainControl.toptrain.position.z;
human.position.set( posx, intersection.point.y+0.6, posz);
// console.log(human.position);
}
if(positionStatus == "downfloor"){
trainControl.downtrain.add(human);
vrwebworker.postMessage("takeDownTrain");
let posx = trainControl.downtrain.position.x - intersection.point.x;
let posz = trainControl.downtrain.position.z - intersection.point.z;
human.position.set( posx, intersection.point.y+0.6, posz);
// console.log(human.position);
}
let postData = {
type:"syn",
url:"/app/simulation/"+group+"/vr",
dataObject:{
type:"pos",
pos:human.position,
}
};
vrwebworker.postMessage(postData);
}
var object = intersection.object;
if(positionStatus == "dm"){
human.position.set( intersection.point.x, intersection.point.y+0.6, intersection.point.z );
}
if(positionStatus == "topfloor"){
let posx = intersection.point.x - trainControl.toptrain.position.x;
let posz = intersection.point.z - trainControl.toptrain.position.z;
human.position.set( posx, intersection.point.y+0.6, posz);
// console.log(human.position);
}
if(positionStatus == "downfloor"){
let posx = trainControl.downtrain.position.x - intersection.point.x;
let posz = trainControl.downtrain.position.z - intersection.point.z;
human.position.set( posx, intersection.point.y+0.6, posz);
// console.log(human.position);
}
let postData = {
type:"syn",
url:"/app/simulation/"+group+"/vr",
dataObject:{
type:"pos",
pos:human.position,
}
};
vrwebworker.postMessage(postData);
}
}
@ -1067,8 +1072,13 @@ export function jl3dFaultDeviceVr(dom,group,skinCode) {
var intersection = intersections[ 0 ];
// console.log(intersection);
var object = intersection.object;
circle.position.set( intersection.point.x, intersection.point.y+0.05, intersection.point.z );
if(intersection.distance <3.5){
var object = intersection.object;
circle.position.set( intersection.point.x, intersection.point.y+0.05, intersection.point.z );
}else{
circle.position.set( 0, 10000, 0 );
}
}
}

View File

@ -108,7 +108,6 @@ export function PassflowConnect(jl3dpass,deviceaction,toptrain,downtrain,routegr
if(downtrain.nowcode != data.body[i].code){
downtrain.nowcode = data.body[i].code;
}
downtrain.position.copy(downtrain.curve.getPointAt(data.body[i].offset));
}else{

Binary file not shown.

Binary file not shown.