From 37eded8d7e107a72d1243becd8b745ce7b0def6e Mon Sep 17 00:00:00 2001 From: Tom Boullay Date: Thu, 30 Apr 2026 10:42:47 +0200 Subject: [PATCH] fix: correct repair case open state rotation --- src/components/three/RepairCaseModel.tsx | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/components/three/RepairCaseModel.tsx b/src/components/three/RepairCaseModel.tsx index d517b0f..4271cab 100644 --- a/src/components/three/RepairCaseModel.tsx +++ b/src/components/three/RepairCaseModel.tsx @@ -13,9 +13,9 @@ interface RepairCaseModelProps { } const CASE_LID_NODE_NAME = "partiesup"; -const CASE_OPEN_ROTATION_OFFSET_Z = 0; -const CASE_CLOSED_ROTATION_OFFSET_Z = THREE.MathUtils.degToRad(-115); -const CASE_ANIMATION_DURATION = 1.2; +const CASE_CLOSED_ROTATION_OFFSET_Z = 0; +const CASE_OPEN_ROTATION_OFFSET_Z = THREE.MathUtils.degToRad(115); +const CASE_ANIMATION_DURATION = 0.8; export function RepairCaseModel({ modelPath, @@ -37,8 +37,12 @@ export function RepairCaseModel({ lidRef.current = lid ?? null; openedRotationZ.current = lid?.rotation.z ?? 0; - if (lid && !initialOpen.current) { - lid.rotation.z = openedRotationZ.current + CASE_CLOSED_ROTATION_OFFSET_Z; + if (lid) { + lid.rotation.z = + openedRotationZ.current + + (initialOpen.current + ? CASE_OPEN_ROTATION_OFFSET_Z + : CASE_CLOSED_ROTATION_OFFSET_Z); } }, [model]);