4.3.2 -> 4.4.2 setCameraAndLookTarget regression

Using 4.3.2 I can successfully use Camera.setCameraAndLookTarget(anotherCamera, 1), but after upgrading to 4.4.2 (at least) the rotation does not match anymore.

Hello Krizzl0r,

The regression you’re experiencing with Camera.setCameraAndLookTarget(anotherCamera, 1) in Needle Engine after upgrading to version 4.4.2 could potentially stem from changes in how the camera’s look-at logic or transformation calculations were handled.

Here’s a suggested approach to investigate and potentially resolve the issue:

  1. Check Changelog: Review the changelog for version 4.4.2 closely, as it may contain notes related to setCameraAndLookTarget or camera transformations that could lead to differences in behavior.

  2. Validate World Position and Forward Direction: Ensure that the worldPosition and worldForward being passed to the ray in the setCameraAndLookTarget method are correctly calculated as they are integral to aligning the camera’s look direction.

  3. Debugging Output: Implement console logs to output the calculated positions and rotations before and after calling setCameraAndLookTarget. This will help identify discrepancies in rotation calculations.

  4. Review LookAt Logic: Investigate the logic within the lookAtObject method (potentially reassessing how it interacts with the camera’s quaternion adjustments). Changes to how the forward direction vector is inverted may affect results postpartum from previous versions.

  5. Local Testing: Optionally revert back to version 4.3.2 in a local setup to confirm if the issue replicates and ensure that it’s tied to the version change.

If after these checks you still find inconsistencies, reporting your findings along with specific input examples to the Needle Engine support might result in valuable insights.

You can also refer to the Needle Engine documentation or the Samples Repository for examples that might help clarify the updated usage patterns.

Let me know if you need further assistance!

1 replies left - Get a PRO license for more AI replies.
thread_8quvuuThOsLw5wCE92wWfXRa
Reply to this message to continue the conversation

You mean OrbitControls.setCameraAndLookTarget ?

This looks correct: Needle-engine - Vite Template (forked) - StackBlitz

Do you think you could share more info how your setup is / how you call that method - maybe provide a reproducible example

Edit: It reproduces in Unity when the object has a camera - will look into it

Edit2: Ok the regression is caused by a change where the look direction should be in Z. However cameras in three.js look into -Z. This regression will be fixed in 4.4.3

Hey. Yes it’s from OrbitControls, sorry. I call it with a Camera object (needle not three).

Hi, yes thanks for clarifying (Unity Camera objects become three.js cameras - so they’re the same thing)

I just lowered the engine dep to 4.3.2 in your stackblitz and the outcome is quite different.

How? I already confirmed the regression and a fix is coming in 4.4.3: 4.3.2 -> 4.4.2 setCameraAndLookTarget regression - #3 by marwie1

4.4.3 is out and should work as expected again. Could you please verify?

I’ve also updated the stackblitz repo: Needle-engine - Vite Template (forked) - StackBlitz

How in terms of how it’s different? The camera jumps rather than transitions. Just put the 4.3.2 in packages.json and see.

By editing a post above, sneaky :wink:

4.4.3 looks good, thanks!

Great, thanks for confirming!