fix: don't update armor highlighting on protagonist shell switch

This commit is contained in:
TrèsAbhi committed 2024-02-22 13:07:13 -06:00
1 parent d81eddba44
commit da767213cb
3 files changed
+353 -344

No files matched your search

@@ -80,16 +80,6 @@ export function ArmorHighlighting() {
turretContainer.current?.position.copy(turretPosition);
turretContainer.current?.rotation.copy(turretRotation);
}
handleModelTransform(useTankopediaTemporary.getState().model.pose);
modelTransformEvent.on(handleModelTransform);
return () => {
modelTransformEvent.off(handleModelTransform);
};
});
useEffect(() => {
const unsubscribe = useTankopediaTemporary.subscribe(
(state) => state.mode,
(mode) => {
@@ -97,8 +87,14 @@ export function ArmorHighlighting() {
},
);
return unsubscribe;
});
handleModelTransform(useTankopediaTemporary.getState().model.pose);
modelTransformEvent.on(handleModelTransform);
return () => {
modelTransformEvent.off(handleModelTransform);
unsubscribe();
};
}, []);
const armorGltf = useArmor(protagonist.tank.id);
const armorNodes = Object.values(armorGltf.nodes);