pub struct OrbitCameraController {
pub target: Point3<f32>,
pub distance: f32,
pub yaw: f32,
pub pitch: f32,
pub min_distance: f32,
pub max_distance: f32,
pub min_pitch: f32,
pub max_pitch: f32,
}Expand description
Orbit / Arcball camera controller that orbits around a focal point.
Ideal for model viewers, strategy games, third-person character cameras, and touch-drag / analog-stick rotation on embedded screens.
Fields§
§target: Point3<f32>Focal point around which the camera orbits.
distance: f32Distance from the camera to the target.
yaw: f32Azimuthal angle (horizontal rotation) in radians.
pitch: f32Polar angle (vertical rotation) in radians. Clamped to prevent flipping.
min_distance: f32Minimum allowed distance (zoom limit).
max_distance: f32Maximum allowed distance.
min_pitch: f32Minimum pitch angle in radians (default: ~ -89°).
max_pitch: f32Maximum pitch angle in radians (default: ~ +89°).
Implementations§
Source§impl OrbitCameraController
impl OrbitCameraController
Sourcepub fn new(target: Point3<f32>, distance: f32) -> Self
pub fn new(target: Point3<f32>, distance: f32) -> Self
Create a new orbit camera controller looking at target from distance.
Sourcepub fn with_distance_limits(self, min: f32, max: f32) -> Self
pub fn with_distance_limits(self, min: f32, max: f32) -> Self
Builder for customizing zoom distance boundaries.
Sourcepub fn with_pitch_limits(self, min: f32, max: f32) -> Self
pub fn with_pitch_limits(self, min: f32, max: f32) -> Self
Builder for customizing pitch clamping limits (in radians).
Sourcepub fn orbit(&mut self, delta_yaw: f32, delta_pitch: f32)
pub fn orbit(&mut self, delta_yaw: f32, delta_pitch: f32)
Rotate around the target by delta yaw and pitch (in radians).
Sourcepub fn pan(&mut self, delta_right: f32, delta_up: f32)
pub fn pan(&mut self, delta_right: f32, delta_up: f32)
Pan the focal target in camera-local horizontal and vertical directions.
Sourcepub fn eye_position(&self) -> Point3<f32>
pub fn eye_position(&self) -> Point3<f32>
Calculate the camera eye position in world space.
Sourcepub fn update_camera(&self, camera: &mut Camera)
pub fn update_camera(&self, camera: &mut Camera)
Synchronize state to an engine Camera.
Trait Implementations§
Source§impl Clone for OrbitCameraController
impl Clone for OrbitCameraController
Source§fn clone(&self) -> OrbitCameraController
fn clone(&self) -> OrbitCameraController
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for OrbitCameraController
Source§impl Debug for OrbitCameraController
impl Debug for OrbitCameraController
Source§impl PartialEq for OrbitCameraController
impl PartialEq for OrbitCameraController
impl StructuralPartialEq for OrbitCameraController
Auto Trait Implementations§
impl Freeze for OrbitCameraController
impl RefUnwindSafe for OrbitCameraController
impl Send for OrbitCameraController
impl Sync for OrbitCameraController
impl Unpin for OrbitCameraController
impl UnsafeUnpin for OrbitCameraController
impl UnwindSafe for OrbitCameraController
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CheckedAs for T
impl<T> CheckedAs for T
Source§fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
Source§impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
Source§fn checked_cast_from(src: Src) -> Option<Dst>
fn checked_cast_from(src: Src) -> Option<Dst>
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> OverflowingAs for T
impl<T> OverflowingAs for T
Source§fn overflowing_as<Dst>(self) -> (Dst, bool)where
T: OverflowingCast<Dst>,
fn overflowing_as<Dst>(self) -> (Dst, bool)where
T: OverflowingCast<Dst>,
Source§impl<Src, Dst> OverflowingCastFrom<Src> for Dstwhere
Src: OverflowingCast<Dst>,
impl<Src, Dst> OverflowingCastFrom<Src> for Dstwhere
Src: OverflowingCast<Dst>,
Source§fn overflowing_cast_from(src: Src) -> (Dst, bool)
fn overflowing_cast_from(src: Src) -> (Dst, bool)
Source§impl<T> SaturatingAs for T
impl<T> SaturatingAs for T
Source§fn saturating_as<Dst>(self) -> Dstwhere
T: SaturatingCast<Dst>,
fn saturating_as<Dst>(self) -> Dstwhere
T: SaturatingCast<Dst>,
Source§impl<Src, Dst> SaturatingCastFrom<Src> for Dstwhere
Src: SaturatingCast<Dst>,
impl<Src, Dst> SaturatingCastFrom<Src> for Dstwhere
Src: SaturatingCast<Dst>,
Source§fn saturating_cast_from(src: Src) -> Dst
fn saturating_cast_from(src: Src) -> Dst
impl<T> Scalar for T
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.