Jump to content
  • Advertisement
Sign in to follow this  
Shamino45

Finding Relative Transformation

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

If you intended to correct an error in the post then please contact us.

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;
		glMultMatrixf(this->FinalMatrix.readArray());

		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?

Share this post


Link to post
Share on other sites
Advertisement
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!