Camera control issue when switching back and forth between OrbitControls and ArcballControls


I need to switch back and forth between OrbitControls and ArcballControls.

However, when switching back to OrbitControls from ArcballControls, the camera controls don’t work the same way as they initially did. Is there a way to restore the camera control without resetting the OrbitControls?

Example here (press Enter to switch controls, Esc to reset)

If you in the example first use the OrbitControls, you’ll notice they function as they should, orbiting around a target. If you then, by pressing Enter, switch to ArcballControls and play around a bit and then switch BACK to OrbitControls (using Enter again), you’ll notice the OrbitControls are acting all crazy.

I suspect this might be due to differences in “possible states” of the camera between OrbitControls and Arcballcontrols. How would I go about updating the OrbitControls’ state during the switch so that the transition would be seamless?

If this is not possible without modifying the target, then that is fine. The user may adjust the target themselves later through panning if needed after the switch. I just want to avoid the crazy behaviour at all costs!

1 Like