AB4D Forum

Full Version: Can I reverse the mouse movement direction of a FirstPersonCamera
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Can I reverse the mouse movement direction of a FirstPersonCamera?  I need to use a FirstPersonCamera, but I'd like to have the scene move with the mouse as a TargetPostionCamera does, as opposed to the camera move with the mouse.  Moving the scene seems more intuitive to me.
You can reverse the direction of camera rotation with setting IsXAxisInverted on MouseCameraController to true.

If you want to reverse the direction of camera movement, then you need to derive your class from MouseCameraController and override the MoveCamera method - for example:

PHP Code:
   public class MyMouseCameraController MouseCameraController
    
{
 
       public override void MoveCamera(double mouseDxdouble mouseDy)
 
       {
 
           // Reverse x movement direction
 
           mouseDx = -mouseDx;

 
           base.MoveCamera(mouseDxmouseDy);
 
       }

 
       //public override void RotateCamera(double mouseDx, double mouseDy)
 
       //{
 
       //    base.RotateCamera(mouseDx, mouseDy);
 
       //}
 
   

As you see, you can also provide your own logic for camera rotation with overriding the RotateCamera.