Parent UniversalCamera to ArcRotateCamera but keep position/rotation

This topic is related to this old post of mine: ArcRotateCamera / make it shift on the Y axis instead of panning

I’m basically trying to parent a Universal Camera to an ArcRotateCamera without a change in position/rotation to be able to do a camera rotation around another target without a change in perspective. I’m stuck at the point, that the rotation of the ArcRotationCamera I get out with the worldMatrix seems not to be correct (or my code has errors, which is probably more likely).

Please check this playground:
It contains three viewports:

  • Top Left: ArcRotateCamera
  • Top Right: UniversalCamera
  • Bottom: Visualization (the red rectangles are the two cameras)

If you press “1” the function positionPiggybackCamera gets called. Notice how the rotation is different. Only if I also set a target to (0, 0, 0) on the UniversalCamera it matches (Lines 123/124).

This is basically the part, where I’m stuck at. What does the setTarget function has to do with the rotation and why is the rotation I get from the worldMatrix seems to be incorrect then? Any help is highly appreciated :slight_smile:

I made some progress:

Pressing “1” does the positioning, CTRL+Click on the Canvas does the parenting. Cameras match now, but I’m sure there is a better way to do this?

Updated Example where I change the target too: