I am working with quaternions and bones.
When applying a quaternion to sinbad bones, I am encountering a strange behaviour. Here is an image of my problem:

On the left side, you can see the kinect skeleton image.
It seems like the bones are rotated more than I expecting... Therefore I got this skinning problems. It looks like the arm is rotate around 360°+n. The quaternions are directly from the KinectV2 and are absolute in the KinectCameraSpace. The only difference between the kinect and ogre coordinate systems are, that the kinect is using a left handed and ogre a right handed system.
Here is the code of a method used below
Code: Select all
static Ogre::Quaternion kinectOrientationToOgreQuaternion(Vector4* orientation)
{
return Ogre::Quaternion(orientation->w, orientation->x, orientation->y, orientation->z);
}For the humerus.L:
- Get the orientation (Quaternion) of the right elbow joint (The elbow holds the orienttion of the shoulder in kinect data, so I will use this, and the right elbow as I want to use sinbad to work like a mirror, not a 1:1 copy of myself)
Code: Select all
KinectHelper::BONE humerusL;
humerusL.position = KinectHelper::kinectPositionToOgreVector(&positions[KinectHelper::getOpponentJoint(JointType_ElbowLeft)].Position);
humerusL.orientation = KinectHelper::kinectOrientationToOgreQuaternion(&orientations[KinectHelper::getOpponentJoint(JointType_ElbowLeft)].Orientation);
KinectHelper::convertCoordinateSystem(&humerusL.orientation);
bones.insert(std::pair<KinectHelper::BONES, KinectHelper::BONE>(KinectHelper::BONES::HumerusL, humerusL));Code: Select all
static void convertCoordinateSystem(Ogre::Quaternion* quat)
{
quat->w = -quat->w;
quat->x = quat->x;
quat->y = quat->y;
quat->z = -quat->z;
}Code: Select all
bone = playerEntity->getSkeleton()->getBone("Humerus.L");
orientation = bone->getParent()->_getFullTransform().extractQuaternion().Inverse() * skeleton->getBoneByName(KinectHelper::BONES::HumerusL).orientation;
bone->setOrientation(orientation);Can someone explain to me what is happening and maybe how I can solve this? I assume that it is possible to move a bone without this strange deformation of the skin.