Root joint rotation in character model imported via blend2bam

I imported a character originally obtained from Adobe Mixamo. The model was originally at an orientation of lying down and floating over the ground head up, presumably due to the z-up-right handed cs used in Blender and Panda3d, I applied a rotation to get the character right way up before saving the blend file which I converted to bam for use in Panda3D.

But, when I print(hip.getHpr()) - I get a value of (0, 90, -180), and this is causing some issues when applying root rotation through bvh files - does anyone have any suggestions on how I might convert the character model for use in Panda3D, with the hip rotation of the bam model at rest pose being (0,0,0)?

What happens if, in Blender, you “apply” that rotation that you gave it? That should bake the rotation into the vertices and armature, thus leaving it without a rotation transformation, and thus open to more-intuitive handling in your code.

I’m already applying the rotation to the model on Blender - the rotation in blender reads 0,0,0 (on the delta too)

You can try the flattening methods, after loading.

https://docs.panda3d.org/1.10/python/reference/panda3d.core.NodePath#panda3d.core.NodePath.flattenLight

This should reset the transformation you applied.

from direct.showbase.ShowBase import ShowBase

class Game(ShowBase):
    def __init__(self):
        ShowBase.__init__(self)
        
        model = loader.loadModel("panda")
        model.set_pos(1, 1, 0)
        model.set_hpr(90, 0, 45)
        model.reparent_to(render)

        model.flatten_light()

        print(model.get_pos())
        print(model.get_hpr())

game = Game()
game.run()

You need to first place the model in the center of the global coordinates, otherwise, the pivot of the object will be reset.

Hmm… In that case, what happens if you don’t rotate your model–do you still get the same HPR values for the joints?

I’m wondering whether you’re not just looking at the local rotations for those joints.

I think what’s been happening is that the character model and all joints except the hip are in the same local space, but the hip(root) joint had a different rotation to make the T pose happen…

when preparing a fbx file in blender to convert via blent2bam, how should the bone axes be configured?

The default blender settings are primary axis Y and secodary axis X - are these the heading and pitch axes?

The bone axes don’t really matter in Panda. But it’s possible that somewhere in the process the rotation was introduced to convert from Y-up to Z-up or back. Blender and Panda3D are both Z-up though, and blend2bam doesn’t introduce any rotations, so the issue was likely created when importing into Blender.