feat: remove reactive pitch and yaw

This commit is contained in:
TrèsAbhi committed 2025-08-12 13:43:11 -05:00
1 parent 4ddf77fc7f
commit 94cba0c9ba
12 files changed
+141 -190

No files matched your search

+3 -16
View File
@@ -45,9 +45,8 @@ export function useTankTransform(
}
function handleModelTransformInner(data?: ModelTransformEventData) {
const duel = duelStore.getState();
const yaw = data?.yaw ?? duel.protagonist.yaw;
const pitch = data?.pitch ?? duel.protagonist.pitch;
const yaw = data?.yaw ?? modelTransformEvent.last!.yaw;
const pitch = data?.pitch ?? modelTransformEvent.last!.pitch;
gunPosition
.set(0, 0, 0)
@@ -102,20 +101,8 @@ export function useTankTransform(
modelTransformEvent.on(handleModelTransform);
const unsubscribes = [
duelStore.subscribe(
(state) => state.protagonist.pitch,
() => handleModelTransformInner(),
),
duelStore.subscribe(
(state) => state.protagonist.yaw,
() => handleModelTransformInner(),
),
() => modelTransformEvent.off(handleModelTransform),
];
return () => {
unsubscribes.forEach((unsubscribe) => unsubscribe());
modelTransformEvent.off(handleModelTransform);
};
}, [track, turret]);
}