• Create Account

## 3d camera movement

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

6 replies to this topic

### #1Jeremiah  Members

122
Like
Likes
Like

Posted 01 January 2000 - 03:38 PM

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

### #2Akura  Members

130
Like
Likes
Like

Posted 01 January 2000 - 04:32 PM

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

### #3acw83  Members

174
Like
Likes
Like

Posted 02 January 2000 - 04:36 PM

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.

### #4Jeremiah  Members

122
Like
Likes
Like

Posted 03 January 2000 - 07:22 AM

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

### #5JD  Members

208
Like
Likes
Like

Posted 03 January 2000 - 08:10 PM

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;-)

### #6paulcoz  Members

230
Like
Likes
Like

Posted 06 January 2000 - 08:01 PM

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.

### #7acw83  Members

174
Like
Likes
Like

Posted 07 January 2000 - 09:26 AM

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.

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.