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
I'm using the drei implementation of camera-controls. I'd want to utilize infinite dolly. However, I still want to limit or clamp the maximum distance (from the controls target I guess). So when dollying in and reaching a certain min distance the target should move forward - just like infinityDolly does (that's fine). At the same time the user should not be able to dolly away indefinitely.
With the following settings the user can dolly out indefinitely.
How can I enable infiniteDolly (on dolly in) but clamp the max distance at the same time?
const DISTANCE_MIN = 1.0
const DISTANCE_MAX = 40.0
const TRUCK_SPEED = 2.0
const DRAGGING_SMOOTH_TIME = 0.05 // don't set to 0 as this leads to bugs (controls are freezing)
<CameraControls
ref={controlsRef}
minZoom={1}
makeDefault={true}
minDistance={DISTANCE_MIN}
maxDistance={DISTANCE_MAX}
truckSpeed={TRUCK_SPEED}
draggingSmoothTime={DRAGGING_SMOOTH_TIME}
dollyToCursor={true}
infinityDolly={true}
/>
I don't know if this is possible because even this example not behaving as I would expect. When dolling out until I can't see the scene anymore, then there is no way to get back closer again (no matter how fiercely I spin the mouse wheel).
Screencast.from.2025-07-16.09-31-57.webm
Also there is another strange issue. If I set draggingSmoothTime to 0, the controls (dolling and panning) randomly freeze. I can then only unfreeze them when using the mouse wheel.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello,
I'm using the drei implementation of camera-controls. I'd want to utilize infinite dolly. However, I still want to limit or clamp the maximum distance (from the controls target I guess). So when dollying in and reaching a certain min distance the target should move forward - just like infinityDolly does (that's fine). At the same time the user should not be able to dolly away indefinitely.
With the following settings the user can dolly out indefinitely.
How can I enable infiniteDolly (on dolly in) but clamp the max distance at the same time?
I don't know if this is possible because even this example not behaving as I would expect. When dolling out until I can't see the scene anymore, then there is no way to get back closer again (no matter how fiercely I spin the mouse wheel).
Screencast.from.2025-07-16.09-31-57.webm
Also there is another strange issue. If I set draggingSmoothTime to 0, the controls (dolling and panning) randomly freeze. I can then only unfreeze them when using the mouse wheel.
Beta Was this translation helpful? Give feedback.
All reactions