read rotation Quaternion

Anything and everything that's related to OGRE or the wider graphics field that doesn't fit into the other forums.
Post Reply
koreos
Halfling
Posts: 43
Joined: Fri Jun 20, 2014 7:05 pm

read rotation Quaternion

Post by koreos »

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
User avatar
dark_sylinc
OGRE Team Member
OGRE Team Member
Posts: 5299
Joined: Sat Jul 21, 2007 4:55 pm
Location: Buenos Aires, Argentina
x 1279
Contact:

Re: read rotation Quaternion

Post by dark_sylinc »

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)
Post Reply