pub struct TnuaBuiltinCrouch {
pub float_offset: Float,
pub height_change_impulse_for_duration: Float,
pub height_change_impulse_limit: Float,
pub uncancellable: bool,
}Expand description
An action for crouching. Only works when TnuaBuiltinWalk is the
basis.
Most of the fields have sane defaults - the only field that must be set is
float_offset, which controls how low the character will crouch
(compared to its regular float offset while standing). That field should typically have a
negative value.
If the player stops crouching while crawling under an obstacle, Tnua will push the character
upward toward the obstacle - which will bring about undesired physics behavior (especially if
the player tries to move). To prevent that, use this action together with
TnuaCrouchEnforcer.
Fields§
§float_offset: FloatControls how low the character will crouch, compared to its regular float offset while standing.
This field should typically have a negative value. A positive value will cause the character to “crouch” upward - which may be an interesting gameplay action, but not what one would call a “crouch”.
height_change_impulse_for_duration: FloatA duration, in seconds, that it should take for the character to change its floating height to start or stop the crouch.
Set this to more than the expected duration of a single frame, so that the character will
some distance for the
spring_dampening force to reduce
its vertical velocity.
height_change_impulse_limit: FloatThe maximum impulse to apply when starting or stopping the crouch.
uncancellable: boolIf set to true, this action will not yield to other action who try to take control.
For example - if the player holds the crouch button, and then hits the jump button while
the crouch button is still pressed, the character will jump if uncancellable is false.
But if uncancellable is true, the character will stay crouched, ignoring the jump
action.
Trait Implementations§
Source§impl Clone for TnuaBuiltinCrouch
impl Clone for TnuaBuiltinCrouch
Source§fn clone(&self) -> TnuaBuiltinCrouch
fn clone(&self) -> TnuaBuiltinCrouch
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for TnuaBuiltinCrouch
impl Debug for TnuaBuiltinCrouch
Source§impl Default for TnuaBuiltinCrouch
impl Default for TnuaBuiltinCrouch
Source§impl TnuaAction for TnuaBuiltinCrouch
impl TnuaAction for TnuaBuiltinCrouch
Source§const VIOLATES_COYOTE_TIME: bool = false
const VIOLATES_COYOTE_TIME: bool = false
Source§type State = TnuaBuiltinCrouchState
type State = TnuaBuiltinCrouchState
Source§fn initiation_decision(
&self,
ctx: TnuaActionContext<'_>,
_being_fed_for: &Stopwatch,
) -> TnuaActionInitiationDirective
fn initiation_decision( &self, ctx: TnuaActionContext<'_>, _being_fed_for: &Stopwatch, ) -> TnuaActionInitiationDirective
Source§fn apply(
&self,
state: &mut Self::State,
ctx: TnuaActionContext<'_>,
lifecycle_status: TnuaActionLifecycleStatus,
motor: &mut TnuaMotor,
) -> TnuaActionLifecycleDirective
fn apply( &self, state: &mut Self::State, ctx: TnuaActionContext<'_>, lifecycle_status: TnuaActionLifecycleStatus, motor: &mut TnuaMotor, ) -> TnuaActionLifecycleDirective
Source§fn proximity_sensor_cast_range(&self) -> Float
fn proximity_sensor_cast_range(&self) -> Float
Source§impl TnuaCrouchEnforcedAction for TnuaBuiltinCrouch
impl TnuaCrouchEnforcedAction for TnuaBuiltinCrouch
Source§fn range_to_cast_up(&self, _state: &Self::State) -> Float
fn range_to_cast_up(&self, _state: &Self::State) -> Float
TnuaCrouchEnforcer::new), to check for a
ceiling. If the sensor finds anything within that range - the crouch will be enforced.Source§fn prevent_cancellation(&mut self)
fn prevent_cancellation(&mut self)
Auto Trait Implementations§
impl Freeze for TnuaBuiltinCrouch
impl RefUnwindSafe for TnuaBuiltinCrouch
impl Send for TnuaBuiltinCrouch
impl Sync for TnuaBuiltinCrouch
impl Unpin for TnuaBuiltinCrouch
impl UnwindSafe for TnuaBuiltinCrouch
Blanket Implementations§
Source§impl<T, U> AsBindGroupShaderType<U> for T
impl<T, U> AsBindGroupShaderType<U> for T
Source§fn as_bind_group_shader_type(&self, _images: &RenderAssets<GpuImage>) -> U
fn as_bind_group_shader_type(&self, _images: &RenderAssets<GpuImage>) -> U
T ShaderType for self. When used in AsBindGroup
derives, it is safe to assume that all images in self exist.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>, 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> FromWorld for Twhere
T: Default,
impl<T> FromWorld for Twhere
T: Default,
Source§fn from_world(_world: &mut World) -> T
fn from_world(_world: &mut World) -> T
Creates Self using default().
Source§impl<T, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
impl<T, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
Source§impl<T> Identity for Twhere
T: ?Sized,
impl<T> Identity for Twhere
T: ?Sized,
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 more