Game Development Stack Exchange is a question and answer site for professional and independent game developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How can I rotate my view around a model? My model has a rotation. If this rotation changed, my view should also change.

The camera should be behind the model everytime.

Thank you very much!

share|improve this question

One thing you can do is to position your camera such that the mounting point is 0, 0 relative to the camera. So a camera position of (0, 100, 50) would be up by 100 and back by 50 from the model you want it to follow.

From there, apply the rotation matrix for the model on the camera's position, this will rotate the offset to the proper position given the rotation of the model. From here simply add the model's Position to the camera's and voila, you have the correct new position!

Now your camera is positioned properly, but your camera is still pointing in the same direction it was before. From here you can either set the LookAt to some position based on the model's world position or rotate your LookAt in a similar fashion to the method used on the camera's position.

Make sure when you rotate your camera's Position or LookAt that it is based on a variable separate from the one you will use to construct your assorted camera matrices. If you only store the current value for the position you are at, and you say to rotate 90 degrees, it can continue to spin every frame! You can still change these starting values for camera effects, just make sure that they are relative changes (such as +y to make the camera go up or +x to view over the right side of your mounted model)

share|improve this answer

The type of camera that keep's a certain point always in focus and can rotate around that focus point and zoom in/out is called an Arc Ball Camera. There are many arc ball camera code samples for XNA. For example, I wrote this sample some time ago: .

JUst be sure to set the camera's target at the position where your model is, and you should be good to go.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.