Camera movement
Getting lots of trouble with the camera movement. I have a model that can walk around in my little engine. Now the camera should follow the player like in e.g. Tomb Raider. I have the orientation of the model and it''s position. But the transformation for the camera is far from being correct. Is there any tutorial out there or can anybody give me an advice?
I''m a weenie when it comes to doing the camera. Most people suggest using quarternions, but I use normal rotation matrices AND manage to avoid the gimbal lock.
Basically, a camera consists of three pts: the camera, an up vector, and the look at vector. Rotating the camera invovles rotating these points locally. So to rotate the camera to the right, you simply rotate the look at vector around the up vector. To roll the camera, you simple rotate the up vector around the look at vector. Just make sure to rotate the correct vectors when rotating.
So to have the camera track the player, simple link the look at vector to the player. WHenever the player moves, move the lookat, up, and camera vectors with the player.
To orbit the camera around the player, simply translate the up vector to the look at position (remmeber the look at position is on the player) then rotate the camera around the up vector.
DX has a function that creates a view matrix from an up, lookat, and camera vectors. . .
Hope that makes sense.
Basically, a camera consists of three pts: the camera, an up vector, and the look at vector. Rotating the camera invovles rotating these points locally. So to rotate the camera to the right, you simply rotate the look at vector around the up vector. To roll the camera, you simple rotate the up vector around the look at vector. Just make sure to rotate the correct vectors when rotating.
So to have the camera track the player, simple link the look at vector to the player. WHenever the player moves, move the lookat, up, and camera vectors with the player.
To orbit the camera around the player, simply translate the up vector to the look at position (remmeber the look at position is on the player) then rotate the camera around the up vector.
DX has a function that creates a view matrix from an up, lookat, and camera vectors. . .
Hope that makes sense.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement