pub struct Physics { /* private fields */ }Expand description
Host-owned Rapier state mirrored from ECS components during Self::step.
Queries reflect the most recently completed physics step, not pending ECS edits.
Use Self::reset to explicitly rebuild after wholesale scene replacement.
Implementations§
Source§impl Physics
impl Physics
Sourcepub fn raycast(
&self,
origin: Vec3,
dir: Vec3,
max_distance: f32,
) -> Option<RayHit>
pub fn raycast( &self, origin: Vec3, dir: Vec3, max_distance: f32, ) -> Option<RayHit>
Closest solid hit, ignoring trigger volumes. dir need not be normalized.
Invalid origins/directions, zero direction and invalid ranges return None.
Sourcepub fn raycast_excluding(
&self,
origin: Vec3,
dir: Vec3,
max_distance: f32,
exclude: Option<Entity>,
) -> Option<RayHit>
pub fn raycast_excluding( &self, origin: Vec3, dir: Vec3, max_distance: f32, exclude: Option<Entity>, ) -> Option<RayHit>
Like raycast, but ignores trigger volumes and the collider of exclude (the caster itself).
Sourcepub fn raycast_with_options(
&self,
origin: Vec3,
dir: Vec3,
max_distance: f32,
options: QueryOptions,
) -> Option<RayHit>
pub fn raycast_with_options( &self, origin: Vec3, dir: Vec3, max_distance: f32, options: QueryOptions, ) -> Option<RayHit>
Closest ray hit under explicit sensor, layer and owner-exclusion filters.
Direction is normalized internally; distance is in metres. Invalid input returns None.
Sourcepub fn body_count(&self) -> usize
pub fn body_count(&self) -> usize
Number of mirrored ECS rigid bodies (world joint anchors are excluded).
Sourcepub fn collider_count(&self) -> usize
pub fn collider_count(&self) -> usize
Number of mirrored colliders.
Sourcepub fn joint_count(&self) -> usize
pub fn joint_count(&self) -> usize
Number of mirrored impulse joints.
Sourcepub fn overlap_sphere(&self, center: Vec3, radius: f32) -> Vec<Entity>
pub fn overlap_sphere(&self, center: Vec3, radius: f32) -> Vec<Entity>
All collider entities intersecting a world-space sphere, including triggers. Returns a sorted unique list; invalid centres/radii return an empty list.
Sourcepub fn overlap_sphere_with_options(
&self,
center: Vec3,
radius: f32,
options: QueryOptions,
) -> Vec<Entity>
pub fn overlap_sphere_with_options( &self, center: Vec3, radius: f32, options: QueryOptions, ) -> Vec<Entity>
Sphere-overlap query with explicit layer, trigger and owner filters. Results are unique collider entity handles in index order.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for Physics
impl !RefUnwindSafe for Physics
impl !UnwindSafe for Physics
impl Send for Physics
impl Sync for Physics
impl Unpin for Physics
impl UnsafeUnpin for Physics
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<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§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.§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.§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.§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.§impl<T> DowncastSend for T
impl<T> DowncastSend for T
§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 moreimpl<T> MaybeSync for T
§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read more§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).§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.