pub struct CameraController {
pub sensitivity: f32,
pub zoom_sensitivity: f32,
pub zoom_range: (f32, f32),
/* private fields */
}Expand description
Camera controller for orbital movement around a target
Fields§
§sensitivity: f32Movement sensitivity
zoom_sensitivity: f32Zoom sensitivity
zoom_range: (f32, f32)Minimum and maximum zoom distances
Implementations§
Source§impl CameraController
impl CameraController
Sourcepub fn set_camera_entity(&mut self, entity: EntityId)
pub fn set_camera_entity(&mut self, entity: EntityId)
Set the camera entity this controller manages
Sourcepub fn set_center(&mut self, center: Point3<f32>)
pub fn set_center(&mut self, center: Point3<f32>)
Set the center point to orbit around
Sourcepub fn set_radius(&mut self, radius: f32)
pub fn set_radius(&mut self, radius: f32)
Set the orbital distance
Sourcepub fn position(&self) -> Point3<f32>
pub fn position(&self) -> Point3<f32>
Get the current camera position based on spherical coordinates
Sourcepub fn view_matrix(&self) -> Matrix4<f32>
pub fn view_matrix(&self) -> Matrix4<f32>
Create the view matrix for the current camera position
Handle mouse button press/release
Sourcepub fn mouse_motion(&mut self, x: f32, y: f32) -> bool
pub fn mouse_motion(&mut self, x: f32, y: f32) -> bool
Handle mouse movement - returns true if camera changed
Sourcepub fn mouse_wheel(&mut self, delta: f32) -> bool
pub fn mouse_wheel(&mut self, delta: f32) -> bool
Handle mouse wheel for zoom - returns true if camera changed
Sourcepub fn update_camera_transform(&self, world: &mut World)
pub fn update_camera_transform(&self, world: &mut World)
Update the camera entity’s transform in the world
Sourcepub fn camera_entity(&self) -> Option<EntityId>
pub fn camera_entity(&self) -> Option<EntityId>
Get the camera entity this controller manages
Trait Implementations§
Auto Trait Implementations§
impl Freeze for CameraController
impl RefUnwindSafe for CameraController
impl Send for CameraController
impl Sync for CameraController
impl Unpin for CameraController
impl UnsafeUnpin for CameraController
impl UnwindSafe for CameraController
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
Mutably borrows from an owned value. Read more
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.