pub struct CharacterController {Show 28 fields
pub position: Vec2,
pub velocity: Vec2,
pub size: Vec2,
pub speed: f32,
pub jump_force: f32,
pub gravity: f32,
pub on_ground: bool,
pub on_slope: bool,
pub max_slope_angle: f32,
pub step_height: f32,
pub coyote_time: f32,
pub coyote_timer: f32,
pub jump_buffer: f32,
pub jump_buffer_timer: f32,
pub wall_stick_time: f32,
pub wall_stick_timer: f32,
pub is_wall_sliding: bool,
pub wall_normal: Vec2,
pub wall_jump_force: Vec2,
pub move_input: f32,
pub jump_requested: bool,
pub crouch: bool,
pub dash_velocity: Vec2,
pub dash_timer: f32,
pub dash_cooldown: f32,
pub dash_speed: f32,
pub dashes_remaining: u32,
pub max_dashes: u32,
}Fields§
§position: Vec2§velocity: Vec2§size: Vec2§speed: f32§jump_force: f32§gravity: f32§on_ground: bool§on_slope: bool§max_slope_angle: f32§step_height: f32§coyote_time: f32§coyote_timer: f32§jump_buffer: f32§jump_buffer_timer: f32§wall_stick_time: f32§wall_stick_timer: f32§is_wall_sliding: bool§wall_normal: Vec2§wall_jump_force: Vec2§move_input: f32§jump_requested: bool§crouch: bool§dash_velocity: Vec2§dash_timer: f32§dash_cooldown: f32§dash_speed: f32§dashes_remaining: u32§max_dashes: u32Implementations§
Source§impl CharacterController
impl CharacterController
pub fn new(position: Vec2, size: Vec2) -> Self
pub fn move_input(&mut self, x: f32)
pub fn request_jump(&mut self)
pub fn request_dash(&mut self)
pub fn update(&mut self, dt: f32, is_grounded: bool, slope_normal: Option<Vec2>)
pub fn is_moving(&self) -> bool
pub fn is_falling(&self) -> bool
pub fn is_jumping(&self) -> bool
pub fn facing_right(&self) -> bool
pub fn aabb_min(&self) -> Vec2
pub fn aabb_max(&self) -> Vec2
Trait Implementations§
Source§impl Clone for CharacterController
impl Clone for CharacterController
Source§fn clone(&self) -> CharacterController
fn clone(&self) -> CharacterController
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for CharacterController
impl RefUnwindSafe for CharacterController
impl Send for CharacterController
impl Sync for CharacterController
impl Unpin for CharacterController
impl UnsafeUnpin for CharacterController
impl UnwindSafe for CharacterController
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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.