pub struct CharacterControllerComponent {Show 25 fields
pub config: CharacterControllerConfig,
pub grounded: bool,
pub velocity: Matrix<f32, Const<3>, Const<1>, ArrayStorage<f32, 3, 1>>,
pub shape: ColliderShape,
pub max_speed: f32,
pub acceleration: f32,
pub jump_impulse: f32,
pub can_jump: bool,
pub is_crouching: bool,
pub is_sprinting: bool,
pub crouch_enabled: bool,
pub crouch_speed_multiplier: f32,
pub sprint_speed_multiplier: f32,
pub standing_half_height: f32,
pub crouching_half_height: f32,
pub crouch_input_was_pressed: bool,
pub sprint_input_was_pressed: bool,
pub jump_input_was_pressed: bool,
pub scale: f32,
pub friction_rate: f32,
pub above_max_friction_rate: f32,
pub engine_input_enabled: bool,
pub disable_gravity: bool,
pub external_movement: Matrix<f32, Const<2>, Const<1>, ArrayStorage<f32, 2, 1>>,
pub external_jump: bool,
}Expand description
First-person character controller with kinematic movement.
Provides walking, jumping, crouching, and sprinting using Rapier’s kinematic character controller. Handles ground detection, slope limits, step climbing, and collision response.
Fields§
§config: CharacterControllerConfigConfiguration for step height, slope limits, and autostep behavior.
grounded: boolWhether the character is currently touching the ground.
velocity: Matrix<f32, Const<3>, Const<1>, ArrayStorage<f32, 3, 1>>Current movement velocity.
shape: ColliderShapeCollision shape (typically a capsule).
max_speed: f32Maximum horizontal movement speed.
acceleration: f32Acceleration rate when moving.
jump_impulse: f32Upward velocity applied when jumping.
can_jump: boolWhether the character can currently jump (grounded and not recently jumped).
is_crouching: boolWhether the character is currently crouching.
is_sprinting: boolWhether the character is currently sprinting.
crouch_enabled: boolWhether crouching is enabled.
crouch_speed_multiplier: f32Speed multiplier when crouching (typically < 1.0).
sprint_speed_multiplier: f32Speed multiplier when sprinting (typically > 1.0).
standing_half_height: f32Capsule half-height when standing.
crouching_half_height: f32Capsule half-height when crouching.
crouch_input_was_pressed: boolInternal state for crouch toggle detection.
sprint_input_was_pressed: boolInternal state for sprint toggle detection.
jump_input_was_pressed: boolInternal state for jump detection.
scale: f32Overall character scale factor.
friction_rate: f32Friction rate applied when grounded and at or below max_speed.
Higher values = faster deceleration. Applied as 1.0 - (rate * dt).
above_max_friction_rate: f32Friction rate applied when grounded and above max_speed.
Applied as exponential decay exp(-rate * dt).
engine_input_enabled: boolWhen false, the engine skips sprint/crouch/jump input for this entity. The game is responsible for setting is_crouching, is_sprinting, and velocity.y. The engine still handles WASD movement, acceleration, friction, gravity, and collision.
disable_gravity: boolWhen true, the engine skips gravity integration and the rapier character solver for this entity, letting game code teleport the player’s transform without physics fighting it. Used by the noclip fly path.
external_movement: Matrix<f32, Const<2>, Const<1>, ArrayStorage<f32, 2, 1>>Camera-relative analog movement injected by game code, treated like a
gamepad left stick: x steers right, y drives forward, magnitude
clamped to one. Non-zero values override keyboard movement for the
frame, which is how an on-screen joystick moves the player.
external_jump: boolA one-shot jump request from game code, consumed by the input system on the next step. Lets an on-screen button jump without a Space key.
Implementations§
Source§impl CharacterControllerComponent
impl CharacterControllerComponent
Sourcepub fn new_capsule(
half_height: f32,
radius: f32,
) -> CharacterControllerComponent
pub fn new_capsule( half_height: f32, radius: f32, ) -> CharacterControllerComponent
Creates a character controller with a capsule collision shape.
Trait Implementations§
Source§impl Clone for CharacterControllerComponent
impl Clone for CharacterControllerComponent
Source§fn clone(&self) -> CharacterControllerComponent
fn clone(&self) -> CharacterControllerComponent
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for CharacterControllerComponent
impl Debug for CharacterControllerComponent
Source§impl Default for CharacterControllerComponent
impl Default for CharacterControllerComponent
Source§fn default() -> CharacterControllerComponent
fn default() -> CharacterControllerComponent
Source§impl<'de> Deserialize<'de> for CharacterControllerComponent
impl<'de> Deserialize<'de> for CharacterControllerComponent
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<CharacterControllerComponent, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<CharacterControllerComponent, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Source§impl From<&CharacterControllerComponent> for SceneCharacterController
impl From<&CharacterControllerComponent> for SceneCharacterController
Source§fn from(controller: &CharacterControllerComponent) -> SceneCharacterController
fn from(controller: &CharacterControllerComponent) -> SceneCharacterController
Source§impl Serialize for CharacterControllerComponent
impl Serialize for CharacterControllerComponent
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
impl StructuralPartialEq for CharacterControllerComponent
Auto Trait Implementations§
impl Freeze for CharacterControllerComponent
impl RefUnwindSafe for CharacterControllerComponent
impl Send for CharacterControllerComponent
impl Sync for CharacterControllerComponent
impl Unpin for CharacterControllerComponent
impl UnsafeUnpin for CharacterControllerComponent
impl UnwindSafe for CharacterControllerComponent
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
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> 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>, which can then be
downcast into Box<dyn 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>, which 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> DowncastSend for T
impl<T> DowncastSend for T
Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
impl<S, T> Duplex<S> for Twhere
T: FromSample<S> + ToSample<S>,
Source§impl<T> FromFormData for Twhere
T: DeserializeOwned,
impl<T> FromFormData for Twhere
T: DeserializeOwned,
Source§fn from_event(ev: &Event) -> Result<T, FromFormDataError>
fn from_event(ev: &Event) -> Result<T, FromFormDataError>
submit event.Source§impl<CustErr, T, Request> FromReq<GetUrl, Request, CustErr> for T
impl<CustErr, T, Request> FromReq<GetUrl, Request, CustErr> for T
Source§async fn from_req(req: Request) -> Result<T, ServerFnError<CustErr>>
async fn from_req(req: Request) -> Result<T, ServerFnError<CustErr>>
Source§impl<CustErr, T, Request> FromReq<Json, Request, CustErr> for T
impl<CustErr, T, Request> FromReq<Json, Request, CustErr> for T
Source§async fn from_req(req: Request) -> Result<T, ServerFnError<CustErr>>
async fn from_req(req: Request) -> Result<T, ServerFnError<CustErr>>
Source§impl<CustErr, T, Request> FromReq<PostUrl, Request, CustErr> for T
impl<CustErr, T, Request> FromReq<PostUrl, Request, CustErr> for T
Source§async fn from_req(req: Request) -> Result<T, ServerFnError<CustErr>>
async fn from_req(req: Request) -> Result<T, ServerFnError<CustErr>>
Source§impl<CustErr, T, Response> FromRes<Json, Response, CustErr> for T
impl<CustErr, T, Response> FromRes<Json, Response, CustErr> for T
Source§async fn from_res(res: Response) -> Result<T, ServerFnError<CustErr>>
async fn from_res(res: Response) -> Result<T, ServerFnError<CustErr>>
Source§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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<CustErr, T, Response> IntoRes<Json, Response, CustErr> for T
impl<CustErr, T, Response> IntoRes<Json, Response, CustErr> for T
Source§async fn into_res(self) -> Result<Response, ServerFnError<CustErr>>
async fn into_res(self) -> Result<Response, ServerFnError<CustErr>>
Source§impl<F, T> IntoSample<T> for Fwhere
T: FromSample<F>,
impl<F, T> IntoSample<T> for Fwhere
T: FromSample<F>,
fn into_sample(self) -> T
Source§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
impl<T> Scalar for T
impl<T> SerializableAny for T
Source§impl<T> StorageAccess<T> for T
impl<T> StorageAccess<T> for T
Source§fn as_borrowed(&self) -> &T
fn as_borrowed(&self) -> &T
Source§fn into_taken(self) -> T
fn into_taken(self) -> 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.