This commit is contained in:
Kseninia Mikhaylova 2024-09-06 14:00:55 +03:00
parent a639fba26b
commit 4dd3e3d237
1 changed files with 22 additions and 18 deletions

View File

@ -279,7 +279,8 @@ watch(() => sidebar.is_open && sidebar.id_clickable, () => {
target_vector.setComponent(1, targetDistance.min)
set_moveto(smooth_target, target_vector)
set_moveto(smooth_move, target_vector.multiply(new Vector3(1.25, 1, 1.25)))
// set_moveto(smooth_move, target_vector.multiply(new Vector3(1.25, 1, 1.25).setY(targetDistance.min)))
set_moveto(smooth_move, new Vector3(targetDistance.min, targetDistance.min, targetDistance.min))
}
}
}, { deep: true })
@ -307,19 +308,6 @@ onBeforeRender(() => {
timer.resetTimer()
home_timer.resetTimer()
if (smooth_move.value) {
camera.value?.position.lerp(smooth_move.value as Vector3, koef);
camera.value?.updateMatrixWorld()
smooth_move.count -= 1
if (smooth_move.count == 1) {
set_moveto(smooth_move, undefined)
if (temp_smooth_move.value) {
set_moveto(smooth_move, temp_smooth_move.value)
set_moveto(temp_smooth_move, undefined)
}
}
}
else
if (smooth_target.value) {
(controls.value as any).target.lerp(smooth_target.value as Vector3, koef);
(controls.value as any).update()
@ -332,6 +320,22 @@ onBeforeRender(() => {
}
}
}
else
if (smooth_move.value) {
camera.value?.position.lerp(smooth_move.value as Vector3, koef);
camera.value?.updateMatrixWorld();
(controls.value as any).update()
smooth_move.count -= 1
if (smooth_move.count == 1) {
set_moveto(smooth_move, undefined)
if (temp_smooth_move.value) {
set_moveto(smooth_move, temp_smooth_move.value)
set_moveto(temp_smooth_move, undefined)
}
}
}
}
})