www.jpct.net

Bones - Skeletal and Pose Animations for jPCT/jPCT-AE => Bones => Topic started by: Tangomajom on April 19, 2016, 10:18:48 am

Title: Which matrix is the best to rotate a bone?
Post by: Tangomajom on April 19, 2016, 10:18:48 am
Hi,

Maybe this sounds a bit stupid, but I can't find out by myself.
So I would like to apply an Euler rotation based animation to my imported rigged model. The animation in the Collada file is played correctly, but I would like to create the same animation programatically.

My idea is to create a quaternion from the original rotation of the bone, and then I'll use the Quaternion.rotateX/Y/Z methods, and then this modified quaternion will go to the JointChannel.
The only question is that how can I reach the current rotation matrix of the bone, to create the good quaternion from it.

I tried to use the SkeletonHelper.getBoneDirection(animatedJoint).getRotationMatrix(), and also the animatedObject.get(0).getSkeletonPose().getLocal(animatedJoint.getIndex()).getTranslation().getRotationMatrix(), and they inverts as well, but none of them produced the expected result.

Please give an advise.

Thanks in advance,
Title: Re: Which matrix is the best to rotate a bone?
Post by: raft on April 19, 2016, 10:26:37 am
to get the rotation quat:

Code: [Select]
new Quaternion(SkeletonPose.getLocal(<index>))
and for sure that means, SkeletonPose.getLocal(<index>) actually contains the rotation information.