Finding Relative Transformation

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

Recommended Posts

My question is about the math involved in scene graphs and how they determine relative translations.. Say I have a node in my tree that is the terrain, positioned at 0, 0, 0. What mathematical equation do I use to find the transformation variables for a dwarf which is located relatively to the above node... I know you have to take the terrains transformation matrix, which should read out 0, 0, 0 to gltranslate... but do I add the dwarf's transformation matrix to find his relative location, or multiply it? I havn't taken any math classes in over 2 years and I admit I'm a bit rusty with my algebra. I'll show you the code I have...
class CDOFNode : public CSceneNode
{
public:

CDOFNode()
{
}

~CDOFNode() { }

void Update()
{

glPushMatrix();
this->FinalMatrix = LocalMatrix * ParentNode->FinalMatrix;

CSceneNode::Update();
glPopMatrix();
}

void Initialize( Vector4 translation) // Updates local matrix
{
LocalMatrix.Translation(translation);
}

private:

Matrix4 LocalMatrix;
};
This doesn't work at all, seeing as how when my program runs I get polygons all over the screen, kinda like a kaleidoscope. I ran the debug and it's obvious that my FinalMatrix is not what it should be. Any help?

multiply it

Share on other sites

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

Create an account

Register a new account

• Forum Statistics

• Total Topics
628754
• Total Posts
2984514

• 12
• 25
• 12
• 10
• 17