_absoluteRotation seems to not be reset correctly when camera rotation is set?

I have created a Playground here: https://www.babylonjs-playground.com/#32L3J1#4

You can see the issue by clicking the buttons in the following order:

  1. Isometric (notice the grid orientation)
  2. Rotate
  3. TopDown
  4. Isometric (notice the grid is now upside down)

So step 4 is the problem. When I click Isometric, I expect it always to show the same perspective.

By inspecting the camera, I can see that the _absoluteRotation quaternion is different, even though the .rotation settings are the same.

cc @PolygonalSun

Lemme take a look and see what’s going on.

So here’s what’s going on. The reason why your camera is showing up as upside down is because your upVector (what the camera considers it’s relative y-axis) is changed by your top-down button. For Isometric to work after Top Down, you just need to set your camera’s upVector to (0,1,0) and that should fix it.

3 Likes

Ok. I tried that but it still misbehaves.
I updated the playground: https://www.babylonjs-playground.com/#32L3J1#7

If you rotate the Isometic view and then click TopDown and then click Isometric again, it flips the camera.

Oh wait… you meant in the button code. I tried it in the camera setup code. Ok that works. Thx.
However, what do you mean by " is changed by your top-down button "? The top-down button just calls setCamera, it doesn’t set any value to camera.upVector. If setCamera changes the upVector, why doesn’t the setCamera in the Isometric button reset it – i.e. why is a separate call to upVector required?

UPDATED: https://www.babylonjs-playground.com/#32L3J1#8