Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix rotation re-renders #16

Open
justinfernald opened this issue Aug 27, 2024 · 1 comment
Open

Fix rotation re-renders #16

justinfernald opened this issue Aug 27, 2024 · 1 comment

Comments

@justinfernald
Copy link
Collaborator

During animations currently they are done using React state and changing that state. This causes possibly unnecessary re-renders. Instead what should be done is this code should be moved to a useEffect hook or something similar to cause modifications to the rotations or what ever other attributes to the mesh reference.

@justinfernald
Copy link
Collaborator Author

justinfernald commented Aug 27, 2024

This is the example code I have seen from the docs on how you might do this
useFrame((state, delta) => (ref.current.rotation.x += delta))

It is possible that fixing this issue will make #7 redundant since I think it is possible the the heavy count of re-renders causes the visual glitches and slow ray casting, but I am not positive. (Edit: This would not make it redundant)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant