# camera / model matrix errors

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

## Recommended Posts

I'm just confused about all this... I have these matrix transforms almost right but they're not quite right. The camera has position, "forward," "up," and "right" vectors. So does the object. To render the object I do gl.glLoadMatrixd(cameramatrix,0); gl.glMultMatrixd(object1.getObjectMatrix(),0); and then draw the points. The camera matrix is: -side.x,up.x,-forward.x,0 -side.y,up.y,-forward.y,0 -side.z,up.z,-forward.z,0 position(dot)side,position(dot)up,position(dot)forward,1 The object matrix is: side.x,side.y,side.z,0 up.x,up.y,up.z,0 forward.x,forward.y,forward.z,0 position.x,position.y,position.z,0 I think I have it mostly correct but things are weird... I think pitching up pitches the camera down among other things. Can anyone help me find the errors, or point me to a resource to help me learn about this (I'm having trouble finding information on this specific method of orientations)?

##### Share on other sites
Couple quick comments. Although you may be indexing them correctly in the code, you're writing your matrices in row-vector format, and OpenGL uses column vectors. Also, I think the middle translation element of your camera matrix needs to be negated. Can't comment on the rotation direction, since we don't know how exactly you're computing your side, up and forward vectors.

##### Share on other sites
Oh, great, thanks. I think that negation fixed it.

If anyone cares those matrices are turned into an array in this order:
0 1 2 3
4 5 6 7
8 9 10 11
12 13 14 15

and that converts it right.

Thanks jyk!

1. 1
Rutin
32
2. 2
3. 3
4. 4
5. 5

• 13
• 69
• 11
• 10
• 14
• ### Forum Statistics

• Total Topics
632967
• Total Posts
3009570
• ### Who's Online (See full list)

There are no registered users currently online

×

## Important Information

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!