pub struct OrbitCamera { /* private fields */ }Expand description
A third-person camera that orbits a smoothly following focus point.
Implementations§
Source§impl OrbitCamera
impl OrbitCamera
Sourcepub fn new(target: Vector<f32>) -> Self
pub fn new(target: Vector<f32>) -> Self
Creates a camera looking at target from the default yaw.
Sourcepub fn facing(target: Vector<f32>, yaw: f32, config: CameraConfig) -> Self
pub fn facing(target: Vector<f32>, yaw: f32, config: CameraConfig) -> Self
Creates a camera looking at target from yaw, with config.
Sourcepub fn config(&self) -> &CameraConfig
pub fn config(&self) -> &CameraConfig
Returns the configuration.
Sourcepub fn set_config(&mut self, config: CameraConfig)
pub fn set_config(&mut self, config: CameraConfig)
Replaces the configuration. The next follow eases the
camera toward the new distance.
Sourcepub fn rotate(&mut self, delta: [f32; 2])
pub fn rotate(&mut self, delta: [f32; 2])
Rotates the camera by [yaw, pitch] deltas in radians. Pitch is clamped
to the configured range.
Sourcepub fn set_yaw(&mut self, yaw: f32)
pub fn set_yaw(&mut self, yaw: f32)
Sets the yaw directly in radians. Use this when the consumer drives the
orientation absolutely (spherical coordinates, snap-to-step yaw) instead
of through rotate deltas.
Sourcepub fn set_pitch(&mut self, pitch: f32)
pub fn set_pitch(&mut self, pitch: f32)
Sets the pitch directly in radians, clamped to the configured range.
Sourcepub fn set_focus(&mut self, focus: Vector<f32>)
pub fn set_focus(&mut self, focus: Vector<f32>)
Sets the focus point directly, bypassing the easing in
follow. Use this when the consumer drives the look-at
target itself (cutscenes, custom focus logic).
Sourcepub fn set_distance(&mut self, distance: f32)
pub fn set_distance(&mut self, distance: f32)
Sets the orbit distance directly, bypassing the easing in
follow. Use this to drive the distance from a custom
model (absolute zoom, aim modes) or a custom clip pass.
Sourcepub fn zoom(&mut self, amount: f32)
pub fn zoom(&mut self, amount: f32)
Zooms by amount. Positive zooms in. Clamped to the configured range.
Sourcepub fn follow(&mut self, target: Vector<f32>, timestep: f32)
pub fn follow(&mut self, target: Vector<f32>, timestep: f32)
Eases the focus point toward target and the orbit distance toward its
pitch-derived goal, frame-rate independently over timestep seconds.
Sourcepub fn clip<C: Clip>(&mut self, world: &C)
pub fn clip<C: Clip>(&mut self, world: &C)
Pulls the camera in if world blocks the line of sight from the focus
point to the eye.
Sourcepub fn eye_at(&self, distance: f32) -> Vector<f32>
pub fn eye_at(&self, distance: f32) -> Vector<f32>
Eye position the camera would have at an arbitrary orbit distance,
using the current yaw, pitch and focus. Useful for custom clip passes
that probe a candidate distance before committing it via
set_distance.
Sourcepub fn steer_toward(
&mut self,
look_direction: Vector<f32>,
strength: f32,
timestep: f32,
)
pub fn steer_toward( &mut self, look_direction: Vector<f32>, strength: f32, timestep: f32, )
Eases the yaw toward look_direction (projected onto the ground plane),
frame-rate independently. Useful for lock-on steering. strength
controls how fast.
Sourcepub fn forward_xz(&self) -> Vector<f32>
pub fn forward_xz(&self) -> Vector<f32>
Forward direction projected onto the ground plane.
Sourcepub fn basis(&self) -> MovementBasis
pub fn basis(&self) -> MovementBasis
The horizontal movement basis for character input.
Sourcepub fn view(&self) -> ViewParameters
pub fn view(&self) -> ViewParameters
The parameters needed to build a view-projection matrix.
Trait Implementations§
Source§impl Clone for OrbitCamera
impl Clone for OrbitCamera
Source§fn clone(&self) -> OrbitCamera
fn clone(&self) -> OrbitCamera
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more