Skip to main content

run_freecamera_controller

Function run_freecamera_controller 

Source
pub fn run_freecamera_controller(
    time: Res<'_, Time<Real>>,
    windows: Query<'_, '_, (&Window, &mut CursorOptions)>,
    accumulated_mouse_motion: Res<'_, AccumulatedMouseMotion>,
    accumulated_mouse_scroll: Res<'_, AccumulatedMouseScroll>,
    mouse_scroll_conversion: Res<'_, MouseScrollPixelsPerLine>,
    touch_input: Res<'_, Touches>,
    mouse_button_input: Res<'_, ButtonInput<MouseButton>>,
    key_input: Res<'_, ButtonInput<KeyCode>>,
    toggle_cursor_grab: Local<'_, bool>,
    mouse_cursor_grab: Local<'_, bool>,
    query: Query<'_, '_, (&mut Transform, &mut FreeCameraState, &FreeCamera), With<Camera>>,
)
Expand description

Updates the camera’s position and orientation based on user input.

  • FreeCamera contains static configuration such as key bindings, movement speed, and sensitivity.
  • FreeCameraState stores the dynamic runtime state, including pitch, yaw, velocity, and enable flags.

This system is typically added via the FreeCameraPlugin.

Axis snapping takes priority over mouse movement.