mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-23 11:39:50 +02:00
feat: remove reactive pitch and yaw
This commit is contained in:
1 parent
4ddf77fc7f
commit
94cba0c9ba
12 files changed
+141
-190
No files matched your search
@@ -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]);
|
||||
}
|
||||
Reference in new issue
Block a user