Dolly to cursor reaches limit
sguimmara opened this issue · comments
Describe the bug
Hi, not sure if a bug, or I am missing something in the configuration.
Even when infinityDolly = true
, I cannot dolly past a certain point without updating the orbit point.
Is there something in the configuration to allow that ?
To Reproduce
In the video below:
- I start by setting the orbit point to the lower right corner of the map
- Then I scroll to dolly on the upper left corner of the map
- After a while, I cannot dolly further.
- I set the orbit point to the point I want to dolly to
- Now, I can dolly further.
dolly_to_cursor.webm
Code
this._orbitControls.dollyToCursor = true;
this._orbitControls.verticalDragToForward = true;
this._orbitControls.minDistance = 2;
this._orbitControls.maxDistance = Infinity;
this._orbitControls.dollySpeed = 1;
Live example
No response
Expected behavior
I would like to be able to dolly to cursor without being limited by the distance.
Screenshots or Video
No response
Device
No response
OS
No response
Browser
No response
Would you mind providing a simplified working example on CodeSandbox or a similar platform to reproduce the problem?
FYI: you must set minDistance to not a small value if you wish to enable infinityDolly
Hi @yomotsu ,
I'm working with @sguimmara. I reproduced this issue with an example derived from the infinity-dolly example: https://codepen.io/tmuguet/pen/poBXyyd .
In this example, if you try to dolly-in in the top-left or top-right corner, you end up getting stuck, whether infinite dolly is enabled or not actually.
Thank you for providing the demo.
I believe the minDistance
value is too small relative to the scene's scale.
For instance, a value of 100
is nearly insignificant when considering camera positions such as camera.position.set(59861, -543453, 600000)
and other similar settings.
Could you try using a larger number for the minDistance value?
Thanks for your prompt answer!
Setting a larger number (like 10000
) fixes this issue, but it comes with some side-effects:
- when we get close to the plane (i.e. our map), the value is obviously too large, so we easily traverse the plane we're targeting (that's why
minDistance
was initially set to such a low value), - when we hit that value,
setOrbitPoint
(which we bind on right-click) makes the camera jump.
We've tried using setBoundary
to bound the target, but it also introduces some other side-effects.
I believe there's no "one value fits all uses-cases". I'll try to have an adaptative minDistance
then.