123
							parent
							
								
									5e70124cb4
								
							
						
					
					
						commit
						a597d7bc57
					
				| 
						 | 
					@ -614,49 +614,52 @@ const changeMap = (img) => {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
// 巡检
 | 
					// 巡检
 | 
				
			||||||
const check = () => {
 | 
					const check = () => {
 | 
				
			||||||
    console.log('照相机坐标', camera.position);
 | 
					    let yn = 8, duration = 0;
 | 
				
			||||||
    console.log('物体坐标', checkArr[checkindex].getWorldPosition(new THREE.Vector3())); 
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    if (checkindex < checkArr.length ) {  
 | 
					    if (checkindex < checkArr.length ) {  
 | 
				
			||||||
        // 显示标签
 | 
					         // 1,提前把下一个目标找到,转动镜头
 | 
				
			||||||
        addLabel(checkArr[checkindex], checkArr[checkindex].isPass);
 | 
					        let nextObj;// 下一个目标
 | 
				
			||||||
 | 
					        if (checkindex == checkArr.length ) {
 | 
				
			||||||
        var checkPosition = checkArr[checkindex].getWorldPosition(new THREE.Vector3());
 | 
					            nextObj = checkArr[0].getWorldPosition(new THREE.Vector3()) 
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        if(checkindex < checkArr.length) { 
 | 
				
			||||||
 | 
					            nextObj = checkArr[checkindex].getWorldPosition(new THREE.Vector3())
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        if (checkindex === 0) {
 | 
				
			||||||
 | 
					            duration = 0
 | 
				
			||||||
 | 
					        } else {
 | 
				
			||||||
 | 
					            duration = 10
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					         // 2,转动镜头
 | 
				
			||||||
 | 
					        gsap.to(controls.target, {
 | 
				
			||||||
 | 
					            x: nextObj.x,
 | 
				
			||||||
 | 
					            y: nextObj.y + yn,
 | 
				
			||||||
 | 
					            z: nextObj.z,
 | 
				
			||||||
 | 
					            duration: duration,
 | 
				
			||||||
 | 
					            ease: "power1.inOut",
 | 
				
			||||||
 | 
					            onComplete: () => {
 | 
				
			||||||
 | 
					                // 3,移动摄像机
 | 
				
			||||||
                gsap.to(camera.position, {
 | 
					                gsap.to(camera.position, {
 | 
				
			||||||
            x: checkPosition.x,
 | 
					                    x: nextObj.x,
 | 
				
			||||||
            y: checkPosition.y + 5.2,
 | 
					                    y: nextObj.y + yn,
 | 
				
			||||||
            z: checkPosition.z,
 | 
					                    z: nextObj.z,
 | 
				
			||||||
                    duration: 10,
 | 
					                    duration: 10,
 | 
				
			||||||
                    ease: 'power1.inOut',
 | 
					                    ease: 'power1.inOut',
 | 
				
			||||||
                    onComplete: () => { 
 | 
					                    onComplete: () => { 
 | 
				
			||||||
                
 | 
					                        // 显示标签,已经检查通过
 | 
				
			||||||
                if (checkindex == checkArr.length - 1) { // 巡检结束
 | 
					                        addLabel(checkArr[checkindex], checkArr[checkindex].isPass);
 | 
				
			||||||
 | 
					                        setTimeout(() => {
 | 
				
			||||||
 | 
					                        if (checkindex == checkArr.length) { // 巡检结束
 | 
				
			||||||
                            checkComplete();
 | 
					                            checkComplete();
 | 
				
			||||||
                        } else {
 | 
					                        } else {
 | 
				
			||||||
                            check()
 | 
					                            check()
 | 
				
			||||||
                            
 | 
					                            
 | 
				
			||||||
                        }
 | 
					                        }
 | 
				
			||||||
 | 
					                        }, 2000)
 | 
				
			||||||
 | 
					                        checkindex++;
 | 
				
			||||||
                    }
 | 
					                    }
 | 
				
			||||||
                });
 | 
					                });
 | 
				
			||||||
        
 | 
					 | 
				
			||||||
        let nextObj;
 | 
					 | 
				
			||||||
        if (checkindex == checkArr.length - 1) {
 | 
					 | 
				
			||||||
            nextObj = checkArr[0].getWorldPosition(new THREE.Vector3())
 | 
					 | 
				
			||||||
        } 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: () => {
 | 
					 | 
				
			||||||
                
 | 
					 | 
				
			||||||
            },
 | 
					            },
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
        checkindex++;
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
// 巡检结束
 | 
					// 巡检结束
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue