This commit is contained in:
Kseninia Mikhaylova 2024-09-03 11:07:43 +03:00
parent 1680150c5f
commit fc6cb8b8f6
1 changed files with 11 additions and 9 deletions

View File

@ -6,6 +6,7 @@ import {
Vector2, Vector3,
CircleGeometry, MeshBasicMaterial,
Quaternion, AdditiveBlending,
Euler,
} from 'three';
import { useTresContext, useSeek, useTexture, useLoop } from '@tresjs/core';
@ -261,14 +262,18 @@ watch(() => sidebar.is_open && sidebar.id_clickable, () => {
el.getWorldPosition(target_vector);
target_vector.y = 10;
controls_targetto.value = target_vector;
const quaternion = new Quaternion();
quaternion.setFromAxisAngle(new Vector3(1, 0, 0), -45 * 3 * (Math.PI / 180));
quaternion.setFromAxisAngle(new Vector3(0, 1, 0), -45 * 3 * (Math.PI / 180));
// quaternion.setFromAxisAngle(new Vector3(0, 0, 1), -15 * (Math.PI / 180));
quaternion.setFromEuler(new Euler(
-45 * 1 * (Math.PI / 180),
35 * 1 * (Math.PI / 180),
35 * 1 * (Math.PI / 180)
));
// quaternion.setFromAxisAngle(new Vector3(0, 1, 0).normalize(), 45 * 4 * (Math.PI / 180));
// quaternion.setFromAxisAngle(new Vector3(0, 0, 1).normalize(), -45 * 4 * (Math.PI / 180));
camera_rotatetoto.value = quaternion
controls_targetto.value = target_vector;
camera_moveto.value = target_vector;
}
}
@ -306,15 +311,12 @@ onAfterRender(() => {
// camera.value?.lookAt(camera_moveto.value)
camera_moveto.value = undefined;
camera_moveto_count.value = COUNT;
// (controls.value as any).maxDistance = targetDistance.max;
// (controls.value as any).minDistance = targetDistance.min;
}
}
if (!controls_targetto.value && !camera_moveto.value && camera_rotatetoto.value) {
timer.stopTimer();
// camera.value?.quaternion.slerp(camera_rotatetoto.value, 0.5);
// camera.value?.quaternion.normalize()
camera.value?.quaternion.slerp(camera_rotatetoto.value, 0.5);
camera.value?.quaternion.normalize()
camera_rotatetoto_count.value -= 1;
if (camera_rotatetoto_count.value == 0) {
camera_rotatetoto_count.value = 10;