Aligning Blender and Panda3d cameras

I’m trying to export Blender cameras as empty groups so I can parent the Panda3d camera to the resulting node and have it all work out.

Unfortunately, it looks like Blender and Panda3d have their cameras looking down different axes. In Blender, a hpr of (0,0,0) is looking at -z axis with the top border towards the +y axis. In Panda3d it’s looking at +y axis with top border to +z axis.

I’m drawing a blank as to how to correctly transform this so it’s correct either in my exporter or in-game.

I think that in-game transfor would be better. In this case in Blender you can target your camera and see view field

Yes, I could do it in-game, but I’m more asking about what exactly I need to do. I can’t understand the transformations intuitively enough to find out what transform I need to apply to get it facing the right way.

Why not use something like:

myCamera = test_model.find('**/Camera')
camera.reparentTo(myCamera )
myCamera.setP(myCamera.getP() - 90)

?

It’s the difference between y-up and z-up. You can multiply the model’s transformation matrix with Mat4.yToZUpMat() or zToYUpMat() to convert back and forth.

This works sometimes, but not in all cases. If I set the camera to be10 degrees lower than horizontal, this correction flips out and points in entirely the wrong direction.

Calling this gets the rotation exactly right, but unfortunately also transforms the translations, putting the camera in the wrong position.

Is there some sort of matrix that I can make that fixes the rotation but doesn’t change the translation?

EDIT: Never mind… I can just store the position of the untransformed node and apply it to the node after the matrix is applied. That worked out fine. Thanks.