Skip to content

setLookAt does not use normalised sphereEnd angles #600

@mortendevold

Description

@mortendevold

Describe the bug

I ran into an issue similar to #597, where the recommended approach was to normalise the angles yourself using cameraControls.normalizeRotations().setLookAt(...).

This did not solve the issue for me, and looking into the setLookAt function, sphericalEnd is set from the position values, and thus no longer normalised. Is this the expected behaviour?

Unfortunately I haven't been able to reproduce this issue in small example. This is part of a bigger application. where you can click around to navigate between a potentially large number of objects. The issue appears to occur when crossing between quadrants in the look direction, where the camera will take close to a full rotation to position itself.

In our case we were able to work around by calling normalizeRotations() after initiating the animated setLookAt(), which updates the values before the transitions start. Wanted to confirm if this is an actual issue, or if we're doing something wrong?

To Reproduce

Steps to reproduce the behavior:

  1. Position the camera looking at an object using setLookAt
  2. Run cameraControls.normalizeRotations().setLookAt(...) at an adjacent object that takes the camera rotation from the 4th to the 1st quadrant, crossing the look direction axis.
  3. Camera does an almost full rotation to position itself, rather than take the shortest route.

Code

Live example

No response

Expected behavior

setLookAt takes the shortest rotation from it's current position to the target look direction.

Screenshots or Video

No response

Device

No response

OS

No response

Browser

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions