Optionalconfig: LuxarFlyControlsConfigPrivatemovePrivatelookPrivatespeedPrivatevelocityPrivateangularPrivateorientationPrivatesavedPrivatesavedPrivateactivePrivatemousePrivatemousePrivatetouchPrivatepinchPrivatecameraPrivatedomPrivatelistenerPrivate ReadonlyexternalPublic method to handle key down events (for external input management)
Public method to handle key up events (for external input management)
PrivatemakePrivatemakePrivatemakePrivatemakePrivateonPrivateonPrivateonPrivateonPrivateonPrivateonPrivateonPrivateonPrivateonPrivateinitializePrivateupdateUpdate controls - must be called in animation loop
Time since last frame in seconds
PrivatemakeSet movement mode
True for low damping (momentum), false for high damping (immediate)
Keep translational glide but discard residual user-input look damping.
Smoothly look at a target position
Target position to look at
Smoothing factor (0-1, higher = smoother)
Save current state (for reset functionality).
Captures camera.position and the internal orientation quaternion
at the time of the call — these become the snapshot restored by
reset(). NOTE: the constructor invokes this once immediately after
initializeFromCamera, so the baseline reflects the camera state at
construction time. Callers that mutate the camera AFTER constructing
the controls must call saveState() again to update the snapshot.
Reset to saved state
Dispose of controls and clean up event listeners
First-person "fly" camera controls with quaternion orientation and inertial physics.
Drives the camera from keyboard (WASD movement, arrow-key look, Q/E roll, Shift boost) and mouse (left-drag strafe, right-drag look, scroll to move, Shift+scroll to roll). In the default inertial mode, motion is integrated as damped velocity each frame rather than applied instantly, so
inertialModeand the damping factors control how much the camera glides; wheninertialModeis false, mouse strafe / scroll / roll are applied directly, while keyboard motion and mouse-drag look stay velocity-integrated. Rotation uses a quaternion, so there is no gimbal lock and orientation is unbounded.Input listeners are attached at construction. Set
externalInputManagementto have the caller forward key events via handleKeyDown / handleKeyUp instead of registering global keyboard listeners; mouse input is always handled internally. Call update once per frame with the elapsed delta to advance the physics.See
ControlsManager which owns and switches between control modes