pub struct SolverBodies { /* private fields */ }Expand description
A resource storing solver bodies and their inertial properties contiguously for awake, active rigid bodies.
Each entity with a solver body stores an index into this resource in a SolverBodyIndex component.
Implementations§
Source§impl SolverBodies
impl SolverBodies
Sourcepub fn bodies(&self) -> &[SolverBody]
pub fn bodies(&self) -> &[SolverBody]
Returns a slice of the solver bodies.
Sourcepub fn bodies_mut(&mut self) -> &mut [SolverBody]
pub fn bodies_mut(&mut self) -> &mut [SolverBody]
Returns a mutable slice of the solver bodies.
Sourcepub fn inertias(&self) -> &[SolverBodyInertia]
pub fn inertias(&self) -> &[SolverBodyInertia]
Returns a slice of the solver body inertias.
Sourcepub fn inertias_mut(&mut self) -> &mut [SolverBodyInertia]
pub fn inertias_mut(&mut self) -> &mut [SolverBodyInertia]
Returns a mutable slice of the solver body inertias.
Sourcepub fn contains_index(&self, index: SolverBodyIndex) -> bool
pub fn contains_index(&self, index: SolverBodyIndex) -> bool
Returns true if the given SolverBodyIndex refers to a body in this collection.
Sourcepub fn contains_entity(&self, entity: Entity) -> bool
pub fn contains_entity(&self, entity: Entity) -> bool
Returns true if the given entity has a solver body in this collection.
Sourcepub fn get_entity(&self, index: SolverBodyIndex) -> Option<Entity>
pub fn get_entity(&self, index: SolverBodyIndex) -> Option<Entity>
Returns the Entity associated with the given solver body index, if any.
Sourcepub fn get(&self, index: SolverBodyIndex) -> Option<&SolverBody>
pub fn get(&self, index: SolverBodyIndex) -> Option<&SolverBody>
Returns a reference to the SolverBody with the given index, if it exists.
Sourcepub fn get_mut(&mut self, index: SolverBodyIndex) -> Option<&mut SolverBody>
pub fn get_mut(&mut self, index: SolverBodyIndex) -> Option<&mut SolverBody>
Returns a mutable reference to the SolverBody with the given index, if it exists.
Sourcepub fn get_inertia(&self, index: SolverBodyIndex) -> Option<&SolverBodyInertia>
pub fn get_inertia(&self, index: SolverBodyIndex) -> Option<&SolverBodyInertia>
Returns a reference to the SolverBodyInertia with the given index, if it exists.
Sourcepub fn get_inertia_mut(
&mut self,
index: SolverBodyIndex,
) -> Option<&mut SolverBodyInertia>
pub fn get_inertia_mut( &mut self, index: SolverBodyIndex, ) -> Option<&mut SolverBodyInertia>
Returns a mutable reference to the SolverBodyInertia with the given index, if it exists.
Sourcepub fn iter_mut(&mut self) -> impl Iterator<Item = &mut SolverBody>
pub fn iter_mut(&mut self) -> impl Iterator<Item = &mut SolverBody>
Returns an iterator over mutable references to the solver bodies.
Sourcepub fn push(
&mut self,
entity: Entity,
body: SolverBody,
inertia: SolverBodyInertia,
) -> SolverBodyIndex
pub fn push( &mut self, entity: Entity, body: SolverBody, inertia: SolverBodyInertia, ) -> SolverBodyIndex
Adds a new solver body for the given entity, returning its SolverBodyIndex.
Sourcepub fn swap_remove(&mut self, index: SolverBodyIndex) -> Option<Entity>
pub fn swap_remove(&mut self, index: SolverBodyIndex) -> Option<Entity>
Removes the solver body with the given index, swapping in the last body to fill the gap.
Returns the entity whose body was moved into index, so that its SolverBodyIndex
component can be updated. Returns None if the removed body was the last one.
§Panics
Panics if the index is out of bounds.
Sourcepub fn access(&mut self) -> SolverBodiesAccess<'_>
pub fn access(&mut self) -> SolverBodiesAccess<'_>
Returns a SolverBodiesAccess that allows obtaining mutable references to solver bodies
from parallel closures via raw pointers.
This allows the solver to hand out mutable references to disjoint bodies concurrently, which is sound as long as the caller ensures that no two closures access the same body at the same time. This is guaranteed by constraint graph coloring.
Trait Implementations§
Source§impl Component for SolverBodies
impl Component for SolverBodies
Source§const STORAGE_TYPE: StorageType = ::bevy::ecs::component::StorageType::SparseSet
const STORAGE_TYPE: StorageType = ::bevy::ecs::component::StorageType::SparseSet
Source§type Mutability = Mutable
type Mutability = Mutable
Component<Mutability = Mutable>,
while immutable components will instead have Component<Mutability = Immutable>. Read moreSource§fn register_required_components(
_requiree: ComponentId,
required_components: &mut RequiredComponentsRegistrator<'_, '_>,
)
fn register_required_components( _requiree: ComponentId, required_components: &mut RequiredComponentsRegistrator<'_, '_>, )
Source§fn clone_behavior() -> ComponentCloneBehavior
fn clone_behavior() -> ComponentCloneBehavior
Source§fn relationship_accessor() -> Option<ComponentRelationshipAccessor<Self>>
fn relationship_accessor() -> Option<ComponentRelationshipAccessor<Self>>
ComponentRelationshipAccessor required for working with relationships in dynamic contexts. Read moreSource§fn on_add() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>
fn on_add() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>
Source§fn on_insert() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>
fn on_insert() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>
Source§fn on_discard() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>
fn on_discard() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>
Source§fn on_remove() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>
fn on_remove() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>
Source§fn on_despawn() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>
fn on_despawn() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>
Source§fn map_entities<E>(_this: &mut Self, _mapper: &mut E)where
E: EntityMapper,
fn map_entities<E>(_this: &mut Self, _mapper: &mut E)where
E: EntityMapper,
EntityMapper. This is used to remap entities in contexts like scenes and entity cloning.
When deriving Component, this is populated by annotating fields containing entities with #[entities] Read moreSource§const HAS_SUMMARY_TICK: bool = false
const HAS_SUMMARY_TICK: bool = false
Source§impl Default for SolverBodies
impl Default for SolverBodies
Source§fn default() -> SolverBodies
fn default() -> SolverBodies
impl Resource for SolverBodies
Auto Trait Implementations§
impl Freeze for SolverBodies
impl RefUnwindSafe for SolverBodies
impl Send for SolverBodies
impl Sync for SolverBodies
impl Unpin for SolverBodies
impl UnsafeUnpin for SolverBodies
impl UnwindSafe for SolverBodies
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<C> Bundle for Cwhere
C: Component,
impl<C> Bundle for Cwhere
C: Component,
fn component_ids( components: &mut ComponentsRegistrator<'_>, ) -> impl Iterator<Item = ComponentId> + use<C>
Source§fn get_component_ids(
components: &Components,
) -> impl Iterator<Item = Option<ComponentId>>
fn get_component_ids( components: &Components, ) -> impl Iterator<Item = Option<ComponentId>>
Source§impl<C> BundleFromComponents for Cwhere
C: Component,
impl<C> BundleFromComponents for Cwhere
C: Component,
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
impl<T> ConditionalSend for Twhere
T: Send,
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<C> DynamicBundle for Cwhere
C: Component,
impl<C> DynamicBundle for Cwhere
C: Component,
Source§unsafe fn get_components(
ptr: MovingPtr<'_, C>,
func: &mut impl FnMut(StorageType, OwningPtr<'_>),
) -> <C as DynamicBundle>::Effect
unsafe fn get_components( ptr: MovingPtr<'_, C>, func: &mut impl FnMut(StorageType, OwningPtr<'_>), ) -> <C as DynamicBundle>::Effect
Source§unsafe fn apply_effect(
_ptr: MovingPtr<'_, MaybeUninit<C>>,
_entity: &mut EntityWorldMut<'_>,
)
unsafe fn apply_effect( _ptr: MovingPtr<'_, MaybeUninit<C>>, _entity: &mut EntityWorldMut<'_>, )
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 moreSource§impl<T> IntoResult<T> for T
impl<T> IntoResult<T> for T
Source§fn into_result(self) -> Result<T, RunSystemError>
fn into_result(self) -> Result<T, RunSystemError>
Source§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
impl<T> Settings for 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.