pub struct TnuaBuiltinJump {
pub horizontal_displacement: Option<Vector3>,
pub allow_in_air: bool,
pub force_forward: Option<Dir3>,
}Expand description
The basic jump action.
This action implements jump physics explained in https://youtu.be/hG9SzQxaCm8 and
https://youtu.be/eeLPL3Y9jjA. Most of its configuration fields have sane defaults - the only
field that must be set is height, which controls the jump
height.
The action must be fed for as long as the player holds the jump button. Once the action stops
being fed, it’ll apply extra gravity to shorten the jump. If the game desires fixed height
jumps instead (where the player cannot make lower jumps by tapping the jump button)
shorten_extra_gravity should be set to 0.0.
Fields§
§horizontal_displacement: Option<Vector3>In addition to the upward motion, add a vertical component to the jump so that the peak of
the jump will be at this vector (multiplied by
TnuaBuiltinJumpConfig::horizontal_distance) from where it’d be otherwise.
allow_in_air: boolAllow this action to start even if the character is not touching ground nor in coyote time.
force_forward: Option<Dir3>Force the character to face in a particular direction.
Note that there are no acceleration limits because unlike
crate::builtins::TnuaBuiltinWalk::desired_forward this field will attempt to force the
direction during a single frame. It is useful for when the jump animation needs to be
aligned with the horizontal_displacement.
Trait Implementations§
Source§impl Default for TnuaBuiltinJump
impl Default for TnuaBuiltinJump
Source§fn default() -> TnuaBuiltinJump
fn default() -> TnuaBuiltinJump
Source§impl<B> TnuaAction<B> for TnuaBuiltinJump
impl<B> TnuaAction<B> for TnuaBuiltinJump
type Config = TnuaBuiltinJumpConfig
Source§type Memory = TnuaBuiltinJumpMemory
type Memory = TnuaBuiltinJumpMemory
Source§fn initiation_decision(
&self,
config: &Self::Config,
_sensors: &B::Sensors<'_>,
ctx: TnuaActionContext<'_, B>,
being_fed_for: &Stopwatch,
) -> TnuaActionInitiationDirective
fn initiation_decision( &self, config: &Self::Config, _sensors: &B::Sensors<'_>, ctx: TnuaActionContext<'_, B>, being_fed_for: &Stopwatch, ) -> TnuaActionInitiationDirective
Source§fn apply(
&self,
config: &Self::Config,
memory: &mut Self::Memory,
_sensors: &B::Sensors<'_>,
ctx: TnuaActionContext<'_, B>,
lifecycle_status: TnuaActionLifecycleStatus,
motor: &mut TnuaMotor,
) -> TnuaActionLifecycleDirective
fn apply( &self, config: &Self::Config, memory: &mut Self::Memory, _sensors: &B::Sensors<'_>, ctx: TnuaActionContext<'_, B>, lifecycle_status: TnuaActionLifecycleStatus, motor: &mut TnuaMotor, ) -> TnuaActionLifecycleDirective
Source§fn influence_basis(
&self,
_config: &Self::Config,
_memory: &Self::Memory,
_ctx: TnuaBasisContext<'_>,
_basis_input: &B,
_basis_config: &<B as TnuaBasis>::Config,
basis_memory: &mut <B as TnuaBasis>::Memory,
)
fn influence_basis( &self, _config: &Self::Config, _memory: &Self::Memory, _ctx: TnuaBasisContext<'_>, _basis_input: &B, _basis_config: &<B as TnuaBasis>::Config, basis_memory: &mut <B as TnuaBasis>::Memory, )
Auto Trait Implementations§
impl Freeze for TnuaBuiltinJump
impl RefUnwindSafe for TnuaBuiltinJump
impl Send for TnuaBuiltinJump
impl Sync for TnuaBuiltinJump
impl Unpin for TnuaBuiltinJump
impl UnwindSafe for TnuaBuiltinJump
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> 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