Bone local coordinate system

Hey everyone,

maybe this question is not very wise, but I have been trying to figure that out and I couldn’t :wink:

Why the bone has its coordinate system different than spatials on the scene ??

When you create a bone and set its bindTransform to identities for position, rotation and scale, you will get a bone that is rotated by -HALF_PI from the world’s coordinate system.
In other words its UP axis points toward -Z instead of +Y.

This causes me some troubles in bones computations in the blender importer. :S

@Kaelthas said: Why the bone has its coordinate system different than spatials on the scene ??
Since the transforms are applied to the model's vertices, it is more efficient to do it in model space than world space (I assume that is what you meant).
@Kaelthas said: When you create a bone and set its bindTransform to identities for position, rotation and scale, you will get a bone that is rotated by -HALF_PI from the world's coordinate system. In other words its UP axis points toward -Z instead of +Y.
Seems to me like you did something wrong then, because no additional transforms are applied apart from what you specify in the bone bind transform and animation transforms. I recommend looking into TestCustomAnim again and making sure you're doing it right. https://code.google.com/p/jmonkeyengine/source/browse/trunk/engine/src/test/jme3test/model/anim/TestCustomAnim.java

Its not enough to just call setBindTransforms(), you have to make sure the inverse world bind transforms are computed as well. When you use the Skeleton(Bone) constructor, it will do that for you based on the bind transforms that the bones currently have set. Hence, if you modify them after using the constructor, you have to call update() and then setBindingPose() on the skeleton after you do that.

3 Likes

@Momoko_Fan thanks for the answer.
I will take a look at it when I get home :slight_smile:

@Momoko_Fan thanks a lot again.
Your answer helped me to solve that issue.

It turned out that bone in blender has different coordinate system (same like in jme - Y axis is UP) that any other object on the scene.
So from blender point of view - it was rotated.

Glad it worked out. Though its strange that blender uses a different coordinate system for armatures. Did you test it with the Y-up fix turned off in the blender importer?

Not yet but I definitely will after my current examples start to work nicely.
At the moment bones look better and better but I still find examples where something goes wrong.