瓶中沙 2024-01-10 12:11:51 +08:00
parent 5e70124cb4
commit a597d7bc57
1 changed files with 37 additions and 34 deletions

View File

@ -614,49 +614,52 @@ const changeMap = (img) => {
}
//
const check = () => {
console.log('照相机坐标', camera.position);
console.log('物体坐标', checkArr[checkindex].getWorldPosition(new THREE.Vector3()));
let yn = 8, duration = 0;
if (checkindex < checkArr.length ) {
//
addLabel(checkArr[checkindex], checkArr[checkindex].isPass);
var checkPosition = checkArr[checkindex].getWorldPosition(new THREE.Vector3());
gsap.to(camera.position, {
x: checkPosition.x,
y: checkPosition.y + 5.2,
z: checkPosition.z,
duration: 10,
ease: 'power1.inOut',
onComplete: () => {
if (checkindex == checkArr.length - 1) { //
checkComplete();
} else {
check()
}
}
});
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())
// 1
let nextObj;//
if (checkindex == checkArr.length ) {
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 + 5.2,
y: nextObj.y + yn,
z: nextObj.z,
duration: 10,
duration: duration,
ease: "power1.inOut",
onComplete: () => {
// 3
gsap.to(camera.position, {
x: nextObj.x,
y: nextObj.y + yn,
z: nextObj.z,
duration: 10,
ease: 'power1.inOut',
onComplete: () => {
//
addLabel(checkArr[checkindex], checkArr[checkindex].isPass);
setTimeout(() => {
if (checkindex == checkArr.length) { //
checkComplete();
} else {
check()
}
}, 2000)
checkindex++;
}
});
},
});
checkindex++;
}
}
//