Advertisement
Guest User

camera class

a guest
Jun 8th, 2013
150
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.79 KB | None | 0 0
  1.     public class Camera3rdPerson
  2.     {
  3.         public Matrix view;
  4.         public Matrix proj;
  5.  
  6.         public Camera3rdPerson()
  7.         {
  8.             proj = Matrix.CreatePerspectiveFieldOfView(0.78f, 1.777f, 1f, 10000f);
  9.            
  10.         }
  11.  
  12.         public void Update(Matrix objectToFollow)
  13.         {
  14.             Vector3 camPosition = objectToFollow.Translation +
  15.                                     (objectToFollow.Backward * 200f) +
  16.                                     (objectToFollow.Up * 150f) +
  17.                                     (objectToFollow.Left * 20f);
  18.  
  19.             Vector3 camTarget = objectToFollow.Translation +
  20.                                 (objectToFollow.Up * 75);
  21.  
  22.             view = Matrix.CreateLookAt(camPosition, camTarget, Vector3.Up);
  23.         }
  24.  
  25.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement