Compare commits
4 Commits
285b084303
...
03d75fd3ab
Author | SHA1 | Date |
---|---|---|
瓶中沙 | 03d75fd3ab | |
瓶中沙 | d2ab5baea8 | |
瓶中沙 | 3339a3d389 | |
瓶中沙 | 3b8d73a47b |
|
@ -78,7 +78,7 @@ let objM = [];
|
|||
// 监测设备
|
||||
let warnSets = [];
|
||||
// 设置漫游索引
|
||||
let currentIndex = 0;
|
||||
let currentIndex = 1;
|
||||
let romeObj = []
|
||||
// 设置巡检
|
||||
let checkArr = [];
|
||||
|
@ -173,16 +173,6 @@ const loadSence = () => {
|
|||
yjobj.push(e);
|
||||
}
|
||||
})
|
||||
// 设置漫游点位
|
||||
const objname = ['start', 'middle1', 'middle2', 'end']
|
||||
objname.forEach((item, index) => {
|
||||
var targetModel = model.getObjectByName(item);
|
||||
if (targetModel) romeObj.push(
|
||||
targetModel
|
||||
)
|
||||
console.log('targetModel', targetModel)
|
||||
})
|
||||
// 漫游结束
|
||||
|
||||
// 获取巡检设备
|
||||
const checkname = [{
|
||||
|
@ -425,47 +415,6 @@ const centerSelectedGroup = (obj) => {
|
|||
tween.start();
|
||||
}
|
||||
|
||||
// 漫游
|
||||
const roam = () => {
|
||||
if (currentIndex < romeObj.length) {
|
||||
console.log('照相机坐标', camera.position);
|
||||
console.log('物体坐标', romeObj[currentIndex].getWorldPosition(new THREE.Vector3()));
|
||||
|
||||
|
||||
var nextPosition = romeObj[currentIndex].getWorldPosition(new THREE.Vector3());
|
||||
// 在动画完成后触发下一个漫游
|
||||
gsap.to(camera.position, {
|
||||
x: nextPosition.x,
|
||||
y: nextPosition.y + 2.2,
|
||||
z: nextPosition.z,
|
||||
duration: 10,
|
||||
ease: 'power1.inOut',
|
||||
onComplete: () => {
|
||||
roam()
|
||||
}
|
||||
});
|
||||
|
||||
let lookObj;
|
||||
if (currentIndex == romeObj.length - 1) {
|
||||
lookObj = romeObj[0].getWorldPosition(new THREE.Vector3())
|
||||
} else if (currentIndex < romeObj.length) {
|
||||
lookObj = romeObj[currentIndex + 1].getWorldPosition(new THREE.Vector3())
|
||||
}
|
||||
gsap.to(controls.target, {
|
||||
x: lookObj.x,
|
||||
y: lookObj.y + 2.2,
|
||||
z: lookObj.z,
|
||||
duration: 10,
|
||||
|
||||
ease: "power1.inOut",
|
||||
onComplete: () => { },
|
||||
});
|
||||
currentIndex++;
|
||||
console.log('lookObj', currentIndex)
|
||||
} else {
|
||||
toHomeView();
|
||||
}
|
||||
}
|
||||
// 返回初始值
|
||||
const toHomeView = () => {
|
||||
// 清除选中框
|
||||
|
@ -623,18 +572,7 @@ const xfadd = (obj, state) => {
|
|||
}
|
||||
// 移除消防标签
|
||||
const removexf = () => {
|
||||
// model.traverse(e => {
|
||||
// if (e.isMesh && e.children.length > 0) {
|
||||
// e.remove(e.children[0])
|
||||
// } else {
|
||||
// e.traverse(o => {
|
||||
// if (o.isMesh && o.children.length > 0) {
|
||||
// o.remove(o.children[0])
|
||||
// }
|
||||
// })
|
||||
|
||||
// }
|
||||
// })
|
||||
console.log(xfobj.length);
|
||||
xfobj.forEach((o) => {
|
||||
// 倒序
|
||||
let obj = o.children[o.children.length-1];
|
||||
|
@ -679,11 +617,11 @@ const changeMap = (img) => {
|
|||
}
|
||||
// 巡检
|
||||
const check = () => {
|
||||
|
||||
if (currentIndex < romeObj.length) {
|
||||
// .getWorldPosition()属性需要用三维向量表示摸个坐标后方可读取
|
||||
var checkPosition = checkArr[checkindex].getWorldPosition(new THREE.Vector3());
|
||||
console.log('照相机坐标', camera.position);
|
||||
console.log('物体坐标', checkArr[checkindex].getWorldPosition(new THREE.Vector3()));
|
||||
|
||||
if (checkindex < checkArr.length ) {
|
||||
var checkPosition = checkArr[checkindex].getWorldPosition(new THREE.Vector3());
|
||||
gsap.to(camera.position, {
|
||||
x: checkPosition.x,
|
||||
y: checkPosition.y + 5.2,
|
||||
|
@ -691,48 +629,42 @@ const check = () => {
|
|||
duration: 10,
|
||||
ease: 'power1.inOut',
|
||||
onComplete: () => {
|
||||
if (checkindex == romeObj.length) { // 巡检结束
|
||||
// 显示标签,已经检查通过
|
||||
addLabel(checkArr[checkindex], checkArr[checkindex].isPass);
|
||||
if (checkindex == checkArr.length - 1) { // 巡检结束
|
||||
checkComplete();
|
||||
} else {
|
||||
check()
|
||||
|
||||
}
|
||||
check()
|
||||
}
|
||||
});
|
||||
var pos1 = new THREE.Vector3( camera.position );
|
||||
|
||||
var pos2 = new THREE.Vector3( checkPosition );
|
||||
|
||||
var distance = pos1.distanceTo(pos2);
|
||||
console.log(12354, distance);
|
||||
|
||||
let nextObj;
|
||||
if (checkindex == checkArr.length - 1) {
|
||||
nextObj = checkArr[0].getWorldPosition(new THREE.Vector3())
|
||||
return;
|
||||
} else if (checkindex < checkArr.length) {
|
||||
} else if (checkindex < checkArr.length - 1) {
|
||||
nextObj = checkArr[checkindex + 1].getWorldPosition(new THREE.Vector3())
|
||||
}
|
||||
|
||||
gsap.to(controls.target, {
|
||||
x: nextObj.x,
|
||||
y: nextObj.y + 5.2,
|
||||
z: nextObj.z,
|
||||
duration: 10,
|
||||
|
||||
ease: "power1.inOut",
|
||||
onComplete: () => {
|
||||
// 显示标签,已经检查通过
|
||||
// addLabel(checkArr[checkindex], checkArr[checkindex].isPass);
|
||||
|
||||
},
|
||||
});
|
||||
checkindex++;
|
||||
console.log('nextObj', checkindex)
|
||||
}
|
||||
}
|
||||
// 巡检结束
|
||||
const checkComplete = () => {
|
||||
toHomeView();
|
||||
checkindex = 0;
|
||||
bimStore().setCheckArr(romeObj);
|
||||
emit('checkComplete', romeObj);
|
||||
bimStore().setCheckArr(checkArr);
|
||||
emit('checkComplete', checkArr);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue