3d camera movement

Started by
5 comments, last by Jeremiah 24 years, 3 months ago
How do you rotate the cameras viewpoint in 3d space? Does anybody have any fast algorithms to do this? From what I understand you dont really move the camera itself, you move all the polygons in the game around the camera. If I wanted to move an object around my camera, would I first have to move its center around the camera, and then all the objects points in the opposite direction? any posts would be appreciated. =)
http://fakemind.com
Advertisement
im not a 3d programemr but i think i have a solution

you should have a uniform vector for camera (x,y,z = 1,1,1) and then rotate this value using cos and sin an all
then you should multipl this vector for all game objects (easy if you use matrices

i hope it helps

akura
It's good to be an outcast, you don't need to explain what you do, you just do it and say you don't belong there.
It''s not quite that simple. If you did that the object''s vertices would rotate but the object itself would not. What you need to do is translate the object so that it''s origin is equal to the camera position. Then you rotate the object''s points. Next you translate the object back to where it was and last rotate the the translation around the camera. If that doesn''t make sense let me give you this example. Say you want rotate a camera looking at a cube. Not only do you want the cube''s points to rotate reverse of the camera, but you also want the cube itself(thus rotating the translation variables)around the camera. I really hope this helps.
Thats what I thought.
you would first have to rotate the objects
center around the camera, and then you would
have to rotate the objects points around the
objects center. good, thats what I thought.

thanx for the posts. =)
http://fakemind.com
Yup, the way I think of it is that if I need to move my camera up then I move the world down and put that negative number into the view matrix. Same if I want to rotate the camera to the left, I rotate the objects in my world to the right. Now don''t laugh... but to help me out to see this better I used an empty transparent cassette tape sleve and drew one vertical and one horizontal line on a paper and I moved the sleve around through which I could see the grid lines in the x-z plane. I use to do this a lot in the beginning especially with that wacky rotate first translate second thing in first person view games;-)
I don''t know a lot about this (still working on getting my own engine to do want I want) but I think you guessed right to begin with. If you have your camera set at a fixed position then transform all the points in your 3D world around the camera (I think you can program a moving viewpoint but your way sounds simpler to me). You could then use matrices (you can read all about them in text books) to rotate, translate your world points around the camera. That''s the way I am trying to do it anyway. Later, Paulcoz.
The problem is that sometimes the vertices are stored relative to their origins, not to the camera. So what I meant was that you''d have to convert them to camera space, then you could rotate just fine.

This topic is closed to new replies.

Advertisement