• ### What is your GameDev Story?

#### Archived

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

# World/View Matrix

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

## 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 ...)

cu
guts (you know, the guy form berserk :D)


• ### What is your GameDev Story?

In 2019 we are celebrating 20 years of GameDev.net! Share your GameDev Story with us.

• 30
• 16
• 11
• 10
• 11
• ### Forum Statistics

• Total Topics
634113
• Total Posts
3015590
×