-
I have few models in scene and when I have camera(first person perspective) close to any model, I wanna active some state and also wanna know model's data, so i have that logic in the useFrame hook and I am setting up global state in useFrame too. But that means the components where I am using that state will also rerender in loop whenever I am close to aby model in scene so ofc its not a good practice so What i doing is, I am comapring both state using JSON.stringify(), before setting up the state, it works for the most parts but sometimes it breaks for some reasons and zustand sets the state on every frame of app. So what could be the solution for this? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
that is normally solved by a physics angine or a raycaster. or a pill collider. im not sure if reactive state is the proper tool for this. |
Beta Was this translation helpful? Give feedback.
that is normally solved by a physics angine or a raycaster. or a pill collider. im not sure if reactive state is the proper tool for this.