pub(crate) struct EntityPhysicsState {
position: DVec3,
bounding_box: WorldAabb,
max_up_step: f32,
backs_off_from_edge: bool,
on_ground: bool,
fall_distance: f64,
descending: bool,
can_walk_on_powder_snow: bool,
is_falling_block: bool,
}Expand description
Immutable entity movement input used by the collision resolver.
Steel keeps authoritative physical state on EntityBase; this type is a
narrow snapshot of the fields vanilla Entity.move needs while resolving a
single movement.
Fields§
§position: DVec3Current position (center of bounding box at feet level).
bounding_box: WorldAabbEntity’s axis-aligned bounding box in world coordinates.
max_up_step: f32Maximum height the entity can step up automatically.
backs_off_from_edge: boolWhether the entity backs away from ledges for this movement.
on_ground: boolWhether the entity is on the ground (affects step-up and jump mechanics).
fall_distance: f64Remaining fall distance for fall damage calculation.
descending: boolWhether vanilla collision context should treat this entity as descending.
can_walk_on_powder_snow: boolWhether vanilla lets this entity walk on powder snow.
is_falling_block: boolWhether vanilla collision context should treat this entity as a falling block.
Implementations§
Source§impl EntityPhysicsState
impl EntityPhysicsState
Sourcepub const fn new(
position: DVec3,
bounding_box: WorldAabb,
max_up_step: f32,
) -> Self
pub const fn new( position: DVec3, bounding_box: WorldAabb, max_up_step: f32, ) -> Self
Creates a new physics state from the current entity bounding box.
Vanilla Entity.move resolves movement from the entity’s actual
boundingBox, not a box reconstructed from dimensions.
Sourcepub const fn bounding_box(self) -> WorldAabb
pub const fn bounding_box(self) -> WorldAabb
Returns the current world-space bounding box.
Sourcepub const fn max_up_step(self) -> f32
pub const fn max_up_step(self) -> f32
Returns the maximum automatic step-up height.
Sourcepub const fn backs_off_from_edge(self) -> bool
pub const fn backs_off_from_edge(self) -> bool
Returns whether sneak-edge prevention should apply.
Sourcepub const fn fall_distance(self) -> f64
pub const fn fall_distance(self) -> f64
Returns the accumulated fall distance before movement.
Sourcepub const fn block_collision_context(self) -> BlockCollisionContext
pub const fn block_collision_context(self) -> BlockCollisionContext
Returns the vanilla block collision context for this movement snapshot.
Sourcepub const fn with_on_ground(self, on_ground: bool) -> Self
pub const fn with_on_ground(self, on_ground: bool) -> Self
Returns a copy with the pre-movement ground flag set.
Sourcepub const fn with_backs_off_from_edge(self, backs_off_from_edge: bool) -> Self
pub const fn with_backs_off_from_edge(self, backs_off_from_edge: bool) -> Self
Returns a copy with sneak-edge prevention enabled or disabled.
Sourcepub const fn with_fall_distance(self, fall_distance: f64) -> Self
pub const fn with_fall_distance(self, fall_distance: f64) -> Self
Returns a copy with the accumulated fall distance set.
Sourcepub const fn with_descending(self, descending: bool) -> Self
pub const fn with_descending(self, descending: bool) -> Self
Returns a copy with the collision-context descending flag set.
Sourcepub const fn with_can_walk_on_powder_snow(
self,
can_walk_on_powder_snow: bool,
) -> Self
pub const fn with_can_walk_on_powder_snow( self, can_walk_on_powder_snow: bool, ) -> Self
Returns a copy with powder-snow walkability set.
Sourcepub const fn with_falling_block(self, is_falling_block: bool) -> Self
pub const fn with_falling_block(self, is_falling_block: bool) -> Self
Returns a copy with falling-block collision context set.
Trait Implementations§
Source§impl Clone for EntityPhysicsState
impl Clone for EntityPhysicsState
Source§fn clone(&self) -> EntityPhysicsState
fn clone(&self) -> EntityPhysicsState
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for EntityPhysicsState
Auto Trait Implementations§
impl Freeze for EntityPhysicsState
impl RefUnwindSafe for EntityPhysicsState
impl Send for EntityPhysicsState
impl Sync for EntityPhysicsState
impl Unpin for EntityPhysicsState
impl UnsafeUnpin for EntityPhysicsState
impl UnwindSafe for EntityPhysicsState
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,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> 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 moreArc<SyncMutex<>>