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


World/View Matrix

Recommended Posts

guts    122
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;
	//  1. Skalierung
	//  2. Rotatation
	//  3. Translation

	CMatrix3 rot3, scale3;

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

	destMatrix = rot3 * scale3;

and my view matrix i calculate this way:
void CCamera::UpdateViewMatrix()
	CMatrix3 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;

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.
guts (you know, the guy form berserk :D)

Share this post

Link to post
Share on other sites