Replies: 1 comment
-
To anyone who encounters this issue... I ended up creating a ref that subscribes to its respective physics properties that need to persist, then I used zustand to create a store to track the physics properties. In a useFrame hook, I update the store values with their respective refs. Also, if this is bad practice, or if there is a better way to handle this, please share! |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hey folks,
Here's my codesandbox demo, for context: https://codesandbox.io/s/angry-bassi-lfvckw?file=/src/App.js
I am attempting to animate the camera (using gsap for tweening) without causing a re-render/resetting of the physics objects. ie. to be able to persist velocity applied on an object, unaffected by the camera tween.
For instance, whenever the ball collides with the box, it has velocity applied (spinning). Once the camera tweens, the velocity does not persist and the box is reset to its initial state.
I am fairly new with react, r3f, and with the cannon lib, so it is possible that I am setting up something incorrectly to cause the issue, so let me know if so!
Any help is greatly appreciated! Thanks in advance...
Beta Was this translation helpful? Give feedback.
All reactions