I am trying to get the camera class from the tutorials to work how I want it to and am having some issues.
I basically have a landscape that I want to be able to move around on like a strategy game. The problems I am having are with trying to be able to rotate around the poin on the landscape that the person is looking at. When I try to use the revolve method, it acts like rotate instead and I am not sure why. I get the rotation, but the position is not updated. Also, the scene shakes when I do the rotate. I have tried to figure out why this happens, but I can't seem to figure it out.
Anyone have any ideas how to get the camera to act this way, or at least what would make my revolve stop working?
These are my functions and how I call them:
public void Rotate(Vector3 axis, float angle)
{
axis = Vector3.Transform(axis, Matrix.CreateFromQuaternion(_rotation));
_rotation = Quaternion.Normalize(Quaternion.CreateFromAxisAngle(axis, angle) * _rotation);
Update();
}
public void Revolve(Vector3 axis, float angle)
{
Vector3 revolveAxis = Vector3.Transform(axis, Matrix.CreateFromQuaternion(_rotation));
Quaternion rotate = Quaternion.CreateFromAxisAngle(revolveAxis, angle);
_position = Vector3.Transform(_lookAt - _position, Matrix.CreateFromQuaternion(rotate)) + _lookAt;
Rotate(axis, angle);
}
CameraManager.ActiveCamera.Revolve(new Vector3(1, 0, 0), mouseMove.Y * 0.01f);
CameraManager.ActiveCamera.Revolve(new Vector3(0, 1, 0), mouseMove.X * 0.01f);