Archived

This topic is now archived and is closed to further replies.

vcGamer

Problem in Rotation

Recommended Posts

I''ve recently made a game engine with build on top of Direct3D 8, which uses my own binary mesh files (TAG) as its sources. Everything is ok, but in animating the hierarchies, I''ve some problems. When I want to rotate a mesh which is a child, I can''t rotate it with it''s parent pivot, and it causes lots of problems for me, please help me. For instance a human in this ways walks wrong, his shins aren''t positioned correctly relative to their thigh, because they (shins) rotate based on their own pivot, not the thighs, please help me. Of course I''ve tested AffineTransformationMatrix, but I think it can''t help me too, please describe it to me more, I really need your help, good bye. game/software developer/algorithm designer

Share this post


Link to post
Share on other sites
I haven''t actually gotten to trying to model hierachical meshes, but I would assume you just apply the transforms from the bottom up. If you are rotating a hierarchical model, you must first apply the rotation for the lowest level, then the next level up, next up etc. For example, shin should rotate about knee (you have to translate first if knee is not at 0,0,0). Now apply leg transform (rotation about hip + translation as necessary). Now apply body transform. Set world matrix and render shin. Go to next level.

Share this post


Link to post
Share on other sites
Well I think you could use a (Matrix)Stack. DirectX8 has a class for it called D3DXMatrixStack if I remember correctly. I haven''t really look into it yet but I used the google search engine and found some sites on it that look interesting (Even if the code is in OpenGL you can still use it and try to understand how it works).

here''s one, just scroll all the way down.
http://www.dgp.utoronto.ca/~ah/csc418/fall_2001/notes/trans_hier.html

Share this post


Link to post
Share on other sites