You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Yeah, this is because the orbits controls don't work in the normal flow of React updates. I could maybe add a flag to the Camera component so that it ignores location settings after the initial mount. A better solution would be to rewrite the orbit camera to send props down to the camera, but that would be a chunk of work.
In my project (for school) I ended up extending the scene-object with a property onOrbit, which is called when the scene is rotated or changed with the orbit controls.
It takes a function and passed the current camera as the only argument.
I further disabled the automatic raycasting to every child on the scene in projectPointerEvent. I had a pointCloud with over a million points in the scene and this killed the performance. Instead i added two properties:
onClickRay: is called when user clicks on the scene, no matter if he clicked on an object. It passes the click event, the current ray (from the camera) and the position
onMouseMoveRay: same as above but on every mouse move.
Hi there,
if my scene gets re-rendered because a prop or state changes, orbit-controls resets to the initial position.
How can i keep it's state?
The text was updated successfully, but these errors were encountered: