I have .skeleton file. I read skeleton as follows
keyframe->getTranslate()
keyframe->getRotation()
getTranslate function gives me correct value as they are in .skeleton.xml file.but getRotation function gives different valus. I can't understand why this is happening? How should I get the same values of rotation as they are in .skeleton.xml file?
Note- I am using binary .skeleton file to read data and .skeleton.xml file to compare with actual values
read rotation Quaternion
- dark_sylinc
- OGRE Team Member
- Posts: 5299
- Joined: Sat Jul 21, 2007 4:55 pm
- Location: Buenos Aires, Argentina
- x 1280
- Contact:
Re: read rotation Quaternion
Hi,
The rotations in the xml format are in Angle-Axis notation. What you're reading is a quaternion.
You can use Quaternion::ToAngleAxis to convert the quaternion back to Angle-Axis notation.
However, you may not get the same value you had in the file, as there are many combinations that are equivalent (i.e. 90° x = 1, y = 0, z = 0 is the same as -90° x = -1, y = 0, z = 0; and also the same as -270° x = 1, y = 0, z = 0); plus there could be floating point precision errors (i.e. you get 0.599999 instead of 0.6, etc)
The rotations in the xml format are in Angle-Axis notation. What you're reading is a quaternion.
You can use Quaternion::ToAngleAxis to convert the quaternion back to Angle-Axis notation.
However, you may not get the same value you had in the file, as there are many combinations that are equivalent (i.e. 90° x = 1, y = 0, z = 0 is the same as -90° x = -1, y = 0, z = 0; and also the same as -270° x = 1, y = 0, z = 0); plus there could be floating point precision errors (i.e. you get 0.599999 instead of 0.6, etc)