-
-
Notifications
You must be signed in to change notification settings - Fork 279
Description
Describe the bug
With minAzumuthAngle
set to a negative value and maxAzimuthAngle
set to a positive value (< pi
), setTarget
(and more specifically normalizeRotations
) results in an azimuthAngle
that doesn't respect the bounds and eventually leads to a jumping motion whenever the bounds are enforced (e.g. after user input)
Based on this bug report, I could submit a pull request that would fix the issue according to my understanding of the problem. As I'm otherwise unfamiliar with the codebase I might do more damage than good, and would therefore first like to get the maintainers' opinion.
My proposed fixes:
- Don't apply normalizeRotations in
setTarget
or - Change normalizeRotations to return values between
minAzimuthAngle
andmaxAzimuthAngle
. This would also affectsetLookAt
To Reproduce
- Set bounds for the
azimuthAngle
, min has to be negative
cameraControls.minAzimuthAngle = THREE.MathUtils.degToRad(-90);
cameraControls.maxAzimuthAngle = THREE.MathUtils.degToRad(90);
- Reach a state of a negative
azimuthAngle
(e.g. with user input)
cameraControls.azimuthAngle = THREE.MathUtils.degToRad(-45);
- At some point call
setTarget
, which will callnormalizeRotations
internally
cameraControls.setTarget(0, 0, 0);
-
normalizeRotations erroneously sets azimuthAngle to a value outside the specified bounds
-
any input to controls (e.g. mouse orbit) will cause the bounds to be enforced, leading to a jumping motion
Code
Live example
Expected behavior
Calling setTarget
should not result in an azimuthAngle
that is outside minAzimuthAngle
and maxAzimuthAngle
when called from a valid state (i.e., azimuthAngle
being within minAzimuthAngle
and maxAzimuthAngle
)
Screenshots or Video
No response
Device
No response
OS
No response
Browser
No response