# Bones and Hierarchy

This topic is 4922 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hi all, Currently i was coding on hierarchial representation an found a problem doing so!! I use left handed system, and represent rotations using quaternions and translation using vector. This is integrated into a class called Frame. The immediate representation of rotation is thru euler (vector) and another vector for translation. A bone object has these elem'nts , i.e. a immediate state and a frame object to represent its world state. When transforming a child bone using its parent's state I do the following: Bone::WorldTransform(Frame &parent) { Quaternion q; q.fromEuler(euler); wstate.orientation = q*parent.orientation; //the quaternion wstate.translation = parent.orientation.rotateVector(wstate.translation) + parent.translation; . . . } Since i'm using d3d I further convert this quaternion into matrix ( a 3x3 basis) and fill the last row of the matrix with the translation info. Now the problem is in my test prog the transformation doesn't seem to work. Not that joints are not displayed, Only x rotation is working properly other rotations bear wiered results. Further I have to use the conjugate of the Quat to get correct results (i.e. the only working x rotations) otherwise the joints are not displayed. My conversion from Quat to Matrix is wholly derived from few article infoes where right handed system with coloumn based format was used.I transposed the derived matrix as it should be. When the exprimentation failed, I negated the m(2,0),m(2,1),m(2,2), members as said in dx sdk reference. Even this doesn't prove right. What could the problem be! I am working on this for two weeks now and am frustrated. Any help will be much appreciated. -Obi

##### Share on other sites
Try negating angle used to produce quaternion. This should be it.

##### Share on other sites
Ok I will try,
But can u tell me why!!

-Obi

##### Share on other sites
Short:
LH is a mirror image of RH. So every angle if inversed.

Long:
Negating one axis, inevitably negates all cross-products calculated in the spatial system. Sinus is, by definition, calculated using cross-product. As cosinus is an "even function" (? don't know the english term), we can negate the angle used to calcualte it without consequences.
So we can simulate negation of cross-pr. by negating the angle.

• ### What is your GameDev Story?

In 2019 we are celebrating 20 years of GameDev.net! Share your GameDev Story with us.

• 15
• 9
• 11
• 9
• 9
• ### Forum Statistics

• Total Topics
634134
• Total Posts
3015744
×