From 78abb52a1d37b26f21301a10586d211ba5345468 Mon Sep 17 00:00:00 2001 From: Kseninia Mikhaylova Date: Mon, 2 Sep 2024 17:42:57 +0300 Subject: [PATCH] test quaternion --- front/src/components/Promo/index.vue | 1 - front/src/components/Promo/load_models.vue | 17 ++++++++++------- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/front/src/components/Promo/index.vue b/front/src/components/Promo/index.vue index 463fd41..07bc372 100644 --- a/front/src/components/Promo/index.vue +++ b/front/src/components/Promo/index.vue @@ -48,7 +48,6 @@ const controlsState = reactive({ const raw_dataStore = useRawData() const route = useRoute() -const clickable = useClickable() const sidebarScene = usePromoScene() watch(() => route.params.target, sidebar.close) diff --git a/front/src/components/Promo/load_models.vue b/front/src/components/Promo/load_models.vue index ba26e65..71344ad 100644 --- a/front/src/components/Promo/load_models.vue +++ b/front/src/components/Promo/load_models.vue @@ -40,7 +40,7 @@ const controls_targetto_count = ref(COUNT) const camera_moveto = ref() as Ref; const camera_moveto_count = ref(COUNT) const camera_rotatetoto = ref() as Ref; -const camera_rotatetoto_count = ref(COUNT) +const camera_rotatetoto_count = ref(10) const sidebar = usePromoSidebar(); const sidebar_scene = usePromoScene(); @@ -264,9 +264,11 @@ watch(() => sidebar.is_open && sidebar.id_clickable, () => { controls_targetto.value = target_vector; const quaternion = new Quaternion(); - quaternion.setFromAxisAngle(new Vector3(1, 0, 0), -45 * 4 * (Math.PI / 180)); + quaternion.setFromAxisAngle(new Vector3(1, 0, 0), -15 * (Math.PI / 180)); + // quaternion.setFromAxisAngle(new Vector3(0, 1, 0), -25 * (Math.PI / 180)); + // quaternion.setFromAxisAngle(new Vector3(0, 0, 1), 10 * (Math.PI / 180)); + camera_rotatetoto.value = quaternion - // camera.value.rotation.z += Math.PI/2 camera_moveto.value = target_vector; } } @@ -310,15 +312,16 @@ onAfterRender(() => { } if (!camera_moveto.value && !controls_targetto.value && camera_rotatetoto.value) { timer.stopTimer(); - camera.value?.quaternion.slerp(camera_rotatetoto.value, koef); - // 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 = COUNT; + camera_rotatetoto_count.value = 10; camera_rotatetoto.value = undefined } + camera.value?.updateMatrixWorld() } - (controls.value as any).update() + // (controls.value as any).update() }) const timer = useTimer()