Jump to content
  • Advertisement

Archived

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

guts

World/View Matrix

This topic is 5297 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

hi! i want to use my own view and world matrix instead of using glTranslatef, etc. (i''m using opengl) hi calculate my worldmatrix this way (for each scenenode in the world):
void CSceneNode::MakeTransform(const CVector3& position, const CVector3& scale, const CQuaternion& orientation, CMatrix4& destMatrix) const
{
	destMatrix = CMatrix4::IDENTITY;
	//Reihenfolge:
	//  1. Skalierung
	//  2. Rotatation
	//  3. Translation

	CMatrix3 rot3, scale3;
	orientation.ToMatrix(rot3);

	scale3 = CMatrix3::ZERO;
	scale3.m[0] = scale.x;
	scale3.m[4] = scale.y;
	scale3.m[8] = scale.z;

	destMatrix = rot3 * scale3;
	destMatrix.SetTransform(position);
}
[/CODE]

and my view matrix i calculate this way:
[CODE]
void CCamera::UpdateViewMatrix()
{
	CMatrix3 rot;
	mAbsOrientation.ToMatrix(rot);

	//Translation relativ zu neuer Achse
	CMatrix3 rotT = rot.Transpose();
	CVector3 trans = -rotT * mAbsPos;

	mViewMatrix = rotT;
	mViewMatrix.m[12] = trans.x;
	mViewMatrix.m[13] = trans.y;
	mViewMatrix.m[14] = trans.z;
	mViewMatrix.m[15] = 1.0f;
}
[/CODE]

before rendering the scenenode I set the world and view matrix (so i multiply them)

my problem is that the camera seems to rotate around the 0,0,0 Vector.
do you have any idea what''s wrong?
(the rotations for scenenode work fine, the problem just occurs with the camera ...)

thanks in advance.
cu
guts (you know, the guy form berserk :D)
   

Share this post


Link to post
Share on other sites
Advertisement

  • 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!