011. Orbit Controls
EXECUTIVE_SUMMARY // AEO_OPTIMIZED
[Answer Engine Overview: What, Why & How]
OrbitControls is the most common camera controller. It orbits a camera around a specific target (usually [0,0,0]). It allows left-click to rotate, right-click to pan, and scroll to zoom. It is not part of the core Three.js library; it must be imported from the examples folder.
022. Damping (Inertia)
If you set controls.enableDamping = true, the camera will glide smoothly to a stop when the user stops dragging, rather than stopping instantly. This feels much more premium. However, it requires you to call controls.update() inside your requestAnimationFrame loop.
033. Controls in R3F
The @react-three/drei library provides a drop-in <OrbitControls /> component. It handles the instantiation, the event listeners, the damping, and the animation loop updates automatically. It's essentially magic.
?Frequently Asked Questions
How do I stop the user from zooming inside my model?
Use `controls.minDistance = 5` (in vanilla) or `<OrbitControls minDistance={5} />` (in R3F) to restrict how close the camera can get to the target.
