Compare commits

...

4 Commits

Author SHA1 Message Date
瓶中沙 03d75fd3ab 123 2024-01-09 21:29:45 +08:00
瓶中沙 d2ab5baea8 123 2024-01-09 21:28:55 +08:00
瓶中沙 3339a3d389 Merge branch 'main' of https://git.shikicc.com/wangqiujuan0808/bw into main 2024-01-09 19:37:34 +08:00
瓶中沙 3b8d73a47b 123 2024-01-09 19:37:29 +08:00
1 changed files with 17 additions and 85 deletions

View File

@ -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;
}