Repository: bevyengine/bevy
File: crates/bevy_camera_controller/src/free_cam.rs (Rust)

Code before:
        write!(
            f,
            "
Freecam Controls:
    Mouse\t- Move camera orientation
    Scroll\t- Adjust movement speed
    {:?}\t- Hold to grab cursor
    {:?}\t- Toggle cursor grab
    {:?} & {:?}\t- Fly forward & backwards
    {:?} & {:?}\t- Fly sideways left & right
    {:?} & {:?}\t- Fly up & down
    {:?}\t- Fly faster while held",
            self.mouse_key_cursor_grab,
            self.keyboard_key_toggle_cursor_grab,
            self.key_forward,
            self.key_back,
            self.key_left,
            self.key_right,
            self.key_up,
            self.key_down,
            self.key_run,
        )
    }
}

/// Stores the state of the FreeCam controller.
///
/// This struct holds the runtime state, including pitch, yaw, velocity, and whether the camera is enabled.
/// It is used to track and update the camera's movement and orientation based on input events.
///
/// Add this component to a [`Camera`] entity, along with the [`FreeCam`] component for the settings,
/// and add the [`FreeCamPlugin`] to your [`App`] to enable freecam controls.
#[derive(Component)]
pub struct FreeCamState {
    /// Enables this [`FreeCam`] when `true`.
    pub enabled: bool,
    /// Indicates if this controller has been initialized by the [`FreeCamPlugin`].
    pub initialized: bool,
    /// This [`FreeCam`]'s pitch rotation.
    pub pitch: f32,
    /// This [`FreeCam`]'s yaw rotation.
    pub yaw: f32,
    /// Multiplier for the walking and running speed.
    pub speed_multiplier: f32,
    /// This [`FreeCam`]'s translation velocity.
    pub velocity: Vec3,
}

impl Default for FreeCamState {
    fn default() -> Self {
        Self {

Review comment (suggestion):
```suggestion
/// Stores the state of the [`FreeCam`] controller.
```

Code after:
            scroll_factor: 0.5,
            friction: 40.0,
        }
    }
}

impl fmt::Display for FreeCam {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        write!(
            f,
            "
Freecam Controls:
    Mouse\t- Move camera orientation
    Scroll\t- Adjust movement speed
    {:?}\t- Hold to grab cursor
    {:?}\t- Toggle cursor grab
    {:?} & {:?}\t- Fly forward & backwards
    {:?} & {:?}\t- Fly sideways left & right
    {:?} & {:?}\t- Fly up & down
    {:?}\t- Fly faster while held",
            self.mouse_key_cursor_grab,
            self.keyboard_key_toggle_cursor_grab,
            self.key_forward,
            self.key_back,
            self.key_left,
            self.key_right,
            self.key_up,
            self.key_down,
            self.key_run,
        )
    }
}

/// Tracks the runtime state of a [`FreeCam`] controller.
///
/// This component holds dynamic data that changes during camera operation,
/// such as pitch, yaw, velocity, and whether the controller is currently enabled.
///
/// It is automatically added to any entity that has a [`FreeCam`] component,
/// and is updated by the [`FreeCamPlugin`] systems in response to user input.
#[derive(Component)]
pub struct FreeCamState {
    /// Enables [`FreeCam`] controls when `true`.
    pub enabled: bool,
    /// Internal flag indicating if this controller has been initialized by the [`FreeCamPlugin`].
    initialized: bool,
    /// This [`FreeCam`]'s pitch rotation.
    pub pitch: f32,
    /// This [`FreeCam`]'s yaw rotation.
    pub yaw: f32,
    /// Multiplier applied to movement speed.