Replies: 1 comment 7 replies
-
You should let r3f handle object disposition, you can just unmount the react component and everything will be disposed. Here's a super simple example https://codesandbox.io/s/r3f-basic-demo-nbyw2?file=/src/index.js |
Beta Was this translation helpful? Give feedback.
7 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Im trying to figure out the best way to dispose of an object (ie a game where if two objects were to touch one would be removed from the scene). I cant figure out how to target the react-three-fiber scene...
if i have a function like this:
js const deleteThing = function() { Scene.remove(mesh); mesh.current.geometry.dispose(); mesh.current.material.dispose(); mesh.current = undefined; }
Scene.remove doesn't target the react-three-fiber scene. Maybe this is easy but just new to react-3-fiber.
could anyone help me with what im supposed to target?
Beta Was this translation helpful? Give feedback.
All reactions