/// <summary> /// Attaches this controller to a user /// </summary> /// <param name="user">User to attach to</param> /// <param name="camera">Camera to control. Can be null</param> public FirstPersonCameraController( ICommandUser user, FirstPersonCamera camera ) { Arguments.CheckNotNull( user, "user" ); user.CommandTriggered += HandleCommand; InteractionUpdateTimer.Instance.Update += OnInteractionUpdate; Camera = camera; }
/// <summary> /// Setup constructor /// </summary> /// <param name="view">Camera view</param> /// <exception cref="System.ArgumentNullException">Thrown if view or planet are null</exception> public UniCameraViewController( IUniCameraView view ) { Arguments.CheckNotNull( view, "view" ); m_View = view; // Create a camera to add to the view FirstPersonCamera camera = new FirstPersonCamera( ); camera.PerspectiveZNear = 1.0f; camera.PerspectiveZFar = 15000.0f; view.Camera = camera; // Bind camera commands to a camera controller ICommandUser user = CommandUser.Default; new FirstPersonCameraController( user, camera ); view.InputSource.AddBindings( user, m_CameraControlBindings ); view.InputSource.Start( ); }
/// <summary> /// Creates the camera used by the main display /// </summary> private static IUniCamera CreateCamera( ) { // FlightCamera camera = new FlightCamera( ); FirstPersonCamera camera = new FirstPersonCamera( ); camera.PerspectiveZNear = 1.0f; camera.PerspectiveZFar = 15000.0f; new FirstPersonCameraController( CommandUser.Default, camera ); //camera.AddChild( new HeadCameraController( context, user ) ); return camera; }