pub struct KinematicCharacterController {
pub up: UnitVector<f32>,
pub offset: CharacterLength,
pub slide: bool,
pub autostep: Option<CharacterAutostep>,
pub max_slope_climb_angle: f32,
pub min_slope_slide_angle: f32,
pub snap_to_ground: Option<CharacterLength>,
pub normal_nudge_factor: f32,
}
Expand description
A character controller for kinematic bodies.
Fields§
§up: UnitVector<f32>
The direction that goes “up”. Used to determine where the floor is, and the floor’s angle.
offset: CharacterLength
A small gap to preserve between the character and its surroundings.
This value should not be too large to avoid visual artifacts, but shouldn’t be too small (must not be zero) to improve numerical stability of the character controller.
slide: bool
Should the character try to slide against the floor if it hits it?
autostep: Option<CharacterAutostep>
Should the character automatically step over small obstacles? (disabled by default)
Note that autostepping is currently a very computationally expensive feature, so it is disabled by default.
max_slope_climb_angle: f32
The maximum angle (radians) between the floor’s normal and the up
vector that the
character is able to climb.
min_slope_slide_angle: f32
The minimum angle (radians) between the floor’s normal and the up
vector before the
character starts to slide down automatically.
snap_to_ground: Option<CharacterLength>
Should the character be automatically snapped to the ground if the distance between the ground and its feed are smaller than the specified threshold?
normal_nudge_factor: f32
Increase this number if your character appears to get stuck when sliding against surfaces.
This is a small distance applied to the movement toward the contact normals of shapes hit by the character controller. This helps shape-casting not getting stuck in an always-penetrating state during the sliding calculation.
This value should remain fairly small since it can introduce artificial “bumps” when sliding along a flat surface.
Implementations§
Source§impl KinematicCharacterController
impl KinematicCharacterController
Sourcepub fn move_shape(
&self,
dt: f32,
bodies: &RigidBodySet,
colliders: &ColliderSet,
queries: &QueryPipeline,
character_shape: &dyn Shape,
character_pos: &Isometry<f32>,
desired_translation: Vector<f32>,
filter: QueryFilter<'_>,
events: impl FnMut(CharacterCollision),
) -> EffectiveCharacterMovement
pub fn move_shape( &self, dt: f32, bodies: &RigidBodySet, colliders: &ColliderSet, queries: &QueryPipeline, character_shape: &dyn Shape, character_pos: &Isometry<f32>, desired_translation: Vector<f32>, filter: QueryFilter<'_>, events: impl FnMut(CharacterCollision), ) -> EffectiveCharacterMovement
Computes the possible movement for a shape.
Sourcepub fn solve_character_collision_impulses<'a>(
&self,
dt: f32,
bodies: &mut RigidBodySet,
colliders: &ColliderSet,
queries: &QueryPipeline,
character_shape: &dyn Shape,
character_mass: f32,
collisions: impl IntoIterator<Item = &'a CharacterCollision>,
filter: QueryFilter<'_>,
)
pub fn solve_character_collision_impulses<'a>( &self, dt: f32, bodies: &mut RigidBodySet, colliders: &ColliderSet, queries: &QueryPipeline, character_shape: &dyn Shape, character_mass: f32, collisions: impl IntoIterator<Item = &'a CharacterCollision>, filter: QueryFilter<'_>, )
For the given collisions between a character and its environment, this method will apply impulses to the rigid-bodies surrounding the character shape at the time of the collisions. Note that the impulse calculation is only approximate as it is not based on a global constraints resolution scheme.
Trait Implementations§
Source§impl Clone for KinematicCharacterController
impl Clone for KinematicCharacterController
Source§fn clone(&self) -> KinematicCharacterController
fn clone(&self) -> KinematicCharacterController
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for KinematicCharacterController
impl Debug for KinematicCharacterController
impl Copy for KinematicCharacterController
Auto Trait Implementations§
impl Freeze for KinematicCharacterController
impl RefUnwindSafe for KinematicCharacterController
impl Send for KinematicCharacterController
impl Sync for KinematicCharacterController
impl Unpin for KinematicCharacterController
impl UnwindSafe for KinematicCharacterController
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> 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>
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>
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)
&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)
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable 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.