diff --git a/src/views/bim/bimHome/components/ThreeView2.vue b/src/views/bim/bimHome/components/ThreeView2.vue index 4a2de19..72b3162 100644 --- a/src/views/bim/bimHome/components/ThreeView2.vue +++ b/src/views/bim/bimHome/components/ThreeView2.vue @@ -685,24 +685,21 @@ const check = () => { duration: 10, ease: 'power1.inOut', onComplete: () => { - if (checkindex == romeObj.length) { // 巡检结束 - checkComplete(); - } check() } }); var pos1 = new THREE.Vector3( camera.position ); - + console.log(12354, pos1); var pos2 = new THREE.Vector3( checkPosition ); - + console.log(54321, pos2); var distance = pos1.distanceTo(pos2); - console.log(12354, distance); + console.log(0, 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, { @@ -710,9 +707,11 @@ const check = () => { y: nextObj.y + 5.2, z: nextObj.z, duration: 10, - ease: "power1.inOut", onComplete: () => { + if (checkindex == romeObj.length) { // 巡检结束 + checkComplete(); + } // 显示标签,已经检查通过 // addLabel(checkArr[checkindex], checkArr[checkindex].isPass); }, @@ -724,7 +723,6 @@ const check = () => { // 巡检结束 const checkComplete = () => { toHomeView(); - checkindex = 0; bimStore().setCheckArr(romeObj); emit('checkComplete', romeObj); return;