Hello,
I am working on a scientific application which should visualize hand movements in 3D with JME. I measure the hand movements with some inertial measurement sensors, which give me a relative rotation to an arbitrary start quaternion.
I have created a hand with skeleton in Blender and could successfully import it with ogreimporter. I am also able to manipulate single bones of my hand skeleton.
I am using following function, which is based on a similar one in RagdollControlUtils
[java]
/**
- Updates a bone position and rotation.
*
-
@param bone
-
the bone<br />
-
@param pos
-
the position<br />
-
@param rot
-
the rotation<br />
*/
public static void setTransform(Bone bone, Vector3f pos, Quaternion rot,
boolean restoreBoneControl) {
// we ensure that we have the control
bone.setUserControl(true);
// we set te user transforms of the bone
bone.setUserTransformsWorld(pos, rot);
for (Bone childBone : bone.getChildren()) {
Transform t = childBone.getCombinedTransform(pos, rot);
setTransform(childBone, t.getTranslation(), t.getRotation(),
restoreBoneControl);
}
// we give back the control to the keyframed animation
if (restoreBoneControl) {
bone.setUserControl(false);
}
}
[/java]
For mapping my sensors to bones I need to initialize my sensor fusion algorithm with start quaternions. So I had the idea of taking the ModelSpaceRotation of my fresh loaded model and update these orientations afterwards with the relative movements of my sensors. This is working, but I need to align the axis of my sensors with the axis of the bones for getting a proper rotation.
On working on that I checked out the initial quaternions of my hand model, but I do not understand why they seems to have different local coordinate systems. All bones are obviously in parallel and pointing upwards on the global y axis, but the root bone has quaternion (w,x,y,z) of (1,0,0,0) and all finger bones have a quaternion of (0,0,1,0) or (0,0,-1,0). I never have rotated these bones in blender, they are strait extruded in one axis from the root bone.
Here is a image of my hand
www.ceh-photo.de/hand.png
It is necessary for me to align all quaternions to one coordinate system to get a proper matching with my sensors.
Can some explain or help on this problem? Or could tell me how I can align all coordinate systems to one orientation?