Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // In my ModelLoad class
- public void LoadContent(ContentManager content)
- {
- Model = content.Load<Model>(_modelName);
- shiftLR = 0;
- camHeight = 175f;
- zoom = 250f;
- camTarget = new Vector3(_modelPos.X, _modelPos.Y + camHeight, _modelPos.Z + -zoom);
- camPos = new Vector3(shiftLR, camHeight, Zoom);
- }
- public Matrix getViewQ()
- {
- Matrix view = Matrix.CreateLookAt(CameraPos, CamTarget, Vector3.Up);
- return view;
- }
- // In my Input class
- // Move Forward (bug when camera position (zoom) equals or exceeds original (_modelPos.Z) position
- if (pController.IsButtonDown(Buttons.LeftThumbstickUp))
- {
- SpeedX = (float)(Math.Sin(ModelLoad.ModelRotation)) * FWDSpeed;
- SpeedZ = (float)(Math.Cos(ModelLoad.ModelRotation)) * FWDSpeed;
- ModelLoad.camPos += Vector3.Forward * SpeedZ;
- ModelLoad.camPos += Vector3.Left * SpeedX;
- ModelLoad._modelPos += Vector3.Forward * SpeedZ;
- ModelLoad._modelPos += Vector3.Left * SpeedX;
- }
- // Move Backward (works perfectly)
- if (pController.IsButtonDown(Buttons.LeftThumbstickDown))
- {
- SpeedX = (float)(Math.Sin(ModelLoad.ModelRotation)) * backwardSpeed;
- SpeedZ = (float)(Math.Cos(ModelLoad.ModelRotation)) * backwardSpeed;
- ModelLoad.camPos += Vector3.Backward * SpeedZ;
- ModelLoad.camPos += Vector3.Right * SpeedX;
- ModelLoad._modelPos += Vector3.Backward * SpeedZ;
- ModelLoad._modelPos += Vector3.Right * SpeedX;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement