pub struct Collider { /* private fields */ }Expand description
A collider used for detecting collisions and generating contacts.
§Creation
Collider has tons of methods for creating colliders of various shapes:
// Create a ball collider with a given radius
commands.spawn(Collider::sphere(0.5));
// Create a capsule collider with a given radius and height
commands.spawn(Collider::capsule(0.5, 2.0));Colliders on their own only detect contacts and generate collision events. To make colliders apply contact forces, they have to be attached to rigid bodies:
use avian3d::prelude::*;
use bevy::prelude::*;
// Spawn a dynamic body that falls onto a static platform
fn setup(mut commands: Commands) {
commands.spawn((
RigidBody::Dynamic,
Collider::sphere(0.5),
Transform::from_xyz(0.0, 2.0, 0.0),
));
commands.spawn((RigidBody::Static, Collider::cuboid(5.0, 0.5, 5.0)));
}Colliders can be further configured using various components like Friction, Restitution,
Sensor, CollisionLayers, CollisionMargin, and ColliderDensity.
If you need to specify the shape of the collider statically, use ColliderConstructor and build your collider
with the Collider::try_from_constructor method.
This can also be done automatically by simply placing the ColliderConstructor on an entity.
Colliders can also be generated automatically for meshes and scenes. See ColliderConstructor and ColliderConstructorHierarchy.
§Multiple Colliders
It can often be useful to attach multiple colliders to the same rigid body.
This can be done in two ways. Either use Collider::compound to have one collider that consists of many
shapes, or for more control, spawn several collider entities as the children of a rigid body:
use avian3d::prelude::*;
use bevy::prelude::*;
fn setup(mut commands: Commands) {
// Spawn a rigid body with one collider on the same entity and two as children
commands
.spawn((RigidBody::Dynamic, Collider::sphere(0.5)))
.with_children(|children| {
// Spawn the child colliders positioned relative to the rigid body
children.spawn((Collider::sphere(0.5), Transform::from_xyz(2.0, 0.0, 0.0)));
children.spawn((Collider::sphere(0.5), Transform::from_xyz(-2.0, 0.0, 0.0)));
});
}Colliders can be arbitrarily nested and transformed relative to the parent.
The rigid body that a collider is attached to can be accessed using the ColliderOf component.
The benefit of using separate entities for the colliders is that each collider can have its own friction, restitution, collision layers, and other configuration options, and they send separate collision events.
§See More
- Rigid bodies
- Density
- Friction and restitution (bounciness)
- Collision layers
- Sensors
- Collision margins for adding extra thickness to colliders
- Generating colliders for meshes and scenes with
ColliderConstructorandColliderConstructorHierarchy - Get colliding entities
- Collision events
- Accessing collision data
- Filtering and modifying contacts with hooks
- Manual contact queries
§Advanced Usage
Internally, Collider uses the shapes provided by parry. If you want to create a collider
using these shapes, you can simply use Collider::from(SharedShape::some_method()).
To get a reference to the internal SharedShape, you can use the Collider::shape()
or Collider::shape_scaled() methods.
Collider is currently not Reflect. If you need to reflect it, you can use ColliderConstructor as a workaround.
Implementations§
Source§impl Collider
impl Collider
Sourcepub fn shape(&self) -> &SharedShape
pub fn shape(&self) -> &SharedShape
Returns the raw unscaled shape of the collider.
Sourcepub fn shape_mut(&mut self) -> &mut SharedShape
pub fn shape_mut(&mut self) -> &mut SharedShape
Returns a mutable reference to the raw unscaled shape of the collider.
Sourcepub fn shape_scaled(&self) -> &SharedShape
pub fn shape_scaled(&self) -> &SharedShape
Returns the shape of the collider with the scale from its GlobalTransform applied.
Sourcepub fn set_shape(&mut self, shape: SharedShape)
pub fn set_shape(&mut self, shape: SharedShape)
Sets the unscaled shape of the collider. The collider’s scale will be applied to this shape.
Sourcepub fn set_scale(&mut self, scale: Vector, num_subdivisions: u32)
pub fn set_scale(&mut self, scale: Vector, num_subdivisions: u32)
Set the global scaling factor of this shape.
If the scaling factor is not uniform, and the scaled shape can’t be
represented as a supported shape, the shape is approximated as
a convex polygon or polyhedron using num_subdivisions.
For example, if a ball was scaled to an ellipse, the new shape would be approximated.
Sourcepub fn project_point(
&self,
translation: impl Into<Position>,
rotation: impl Into<Rotation>,
point: Vector,
solid: bool,
) -> (Vector, bool)
pub fn project_point( &self, translation: impl Into<Position>, rotation: impl Into<Rotation>, point: Vector, solid: bool, ) -> (Vector, bool)
Projects the given point onto self transformed by translation and rotation.
The returned tuple contains the projected point and whether it is inside the collider.
If solid is true and the given point is inside of the collider, the projection will be at the point.
Otherwise, the collider will be treated as hollow, and the projection will be at the collider’s boundary.
Sourcepub fn distance_to_point(
&self,
translation: impl Into<Position>,
rotation: impl Into<Rotation>,
point: Vector,
solid: bool,
) -> Scalar
pub fn distance_to_point( &self, translation: impl Into<Position>, rotation: impl Into<Rotation>, point: Vector, solid: bool, ) -> Scalar
Computes the minimum distance between the given point and self transformed by translation and rotation.
If solid is true and the given point is inside of the collider, the returned distance will be 0.0.
Otherwise, the collider will be treated as hollow, and the distance will be the distance
to the collider’s boundary.
Sourcepub fn contains_point(
&self,
translation: impl Into<Position>,
rotation: impl Into<Rotation>,
point: Vector,
) -> bool
pub fn contains_point( &self, translation: impl Into<Position>, rotation: impl Into<Rotation>, point: Vector, ) -> bool
Tests whether the given point is inside of self transformed by translation and rotation.
Sourcepub fn cast_ray(
&self,
translation: impl Into<Position>,
rotation: impl Into<Rotation>,
ray_origin: Vector,
ray_direction: Vector,
max_distance: Scalar,
solid: bool,
) -> Option<(Scalar, Vector)>
pub fn cast_ray( &self, translation: impl Into<Position>, rotation: impl Into<Rotation>, ray_origin: Vector, ray_direction: Vector, max_distance: Scalar, solid: bool, ) -> Option<(Scalar, Vector)>
Computes the distance and normal between the given ray and self
transformed by translation and rotation.
The returned tuple is in the format (distance, normal).
§Arguments
ray_origin: Where the ray is cast from.ray_direction: What direction the ray is cast in.max_distance: The maximum distance the ray can travel.solid: If true and the ray origin is inside of a collider, the hit point will be the ray origin itself. Otherwise, the collider will be treated as hollow, and the hit point will be at the collider’s boundary.
Sourcepub fn intersects_ray(
&self,
translation: impl Into<Position>,
rotation: impl Into<Rotation>,
ray_origin: Vector,
ray_direction: Vector,
max_distance: Scalar,
) -> bool
pub fn intersects_ray( &self, translation: impl Into<Position>, rotation: impl Into<Rotation>, ray_origin: Vector, ray_direction: Vector, max_distance: Scalar, ) -> bool
Tests whether the given ray intersects self transformed by translation and rotation.
§Arguments
ray_origin: Where the ray is cast from.ray_direction: What direction the ray is cast in.max_distance: The maximum distance the ray can travel.
Sourcepub fn compound(
shapes: Vec<(impl Into<Position>, impl Into<Rotation>, impl Into<Collider>)>,
) -> Self
pub fn compound( shapes: Vec<(impl Into<Position>, impl Into<Rotation>, impl Into<Collider>)>, ) -> Self
Creates a collider with a compound shape defined by a given vector of colliders with a position and a rotation.
Especially for dynamic rigid bodies, compound shape colliders should be preferred over triangle meshes and polylines, because convex shapes typically provide more reliable results.
If you want to create a compound shape from a 3D triangle mesh or 2D polyline, consider using the
Collider::convex_decomposition method.
Sourcepub fn sphere(radius: Scalar) -> Self
pub fn sphere(radius: Scalar) -> Self
Creates a collider with a sphere shape defined by its radius.
Sourcepub fn cuboid(x_length: Scalar, y_length: Scalar, z_length: Scalar) -> Self
pub fn cuboid(x_length: Scalar, y_length: Scalar, z_length: Scalar) -> Self
Creates a collider with a cuboid shape defined by its extents.
Sourcepub fn round_cuboid(
x_length: Scalar,
y_length: Scalar,
z_length: Scalar,
border_radius: Scalar,
) -> Self
pub fn round_cuboid( x_length: Scalar, y_length: Scalar, z_length: Scalar, border_radius: Scalar, ) -> Self
Creates a collider with a cuboid shape defined by its extents and rounded corners.
Sourcepub fn cylinder(radius: Scalar, height: Scalar) -> Self
pub fn cylinder(radius: Scalar, height: Scalar) -> Self
Creates a collider with a cylinder shape defined by its radius
on the XZ plane and its height along the Y axis.
Sourcepub fn cone(radius: Scalar, height: Scalar) -> Self
pub fn cone(radius: Scalar, height: Scalar) -> Self
Creates a collider with a cone shape defined by the radius of its base
on the XZ plane and its height along the Y axis.
Sourcepub fn capsule(radius: Scalar, length: Scalar) -> Self
pub fn capsule(radius: Scalar, length: Scalar) -> Self
Creates a collider with a capsule shape defined by its radius
and its height along the Y axis, excluding the hemispheres.
Sourcepub fn capsule_endpoints(radius: Scalar, a: Vector, b: Vector) -> Self
pub fn capsule_endpoints(radius: Scalar, a: Vector, b: Vector) -> Self
Creates a collider with a capsule shape defined by its radius and endpoints a and b.
Sourcepub fn half_space(outward_normal: Vector) -> Self
pub fn half_space(outward_normal: Vector) -> Self
Creates a collider with a half-space shape defined by the outward normal of its planar boundary.
Sourcepub fn segment(a: Vector, b: Vector) -> Self
pub fn segment(a: Vector, b: Vector) -> Self
Creates a collider with a segment shape defined by its endpoints a and b.
Sourcepub fn triangle(a: Vector, b: Vector, c: Vector) -> Self
pub fn triangle(a: Vector, b: Vector, c: Vector) -> Self
Creates a collider with a triangle shape defined by its points a, b, and c.
Sourcepub fn polyline(vertices: Vec<Vector>, indices: Option<Vec<[u32; 2]>>) -> Self
pub fn polyline(vertices: Vec<Vector>, indices: Option<Vec<[u32; 2]>>) -> Self
Creates a collider with a polyline shape defined by its vertices and optionally an index buffer.
Sourcepub fn trimesh(vertices: Vec<Vector>, indices: Vec<[u32; 3]>) -> Self
pub fn trimesh(vertices: Vec<Vector>, indices: Vec<[u32; 3]>) -> Self
Creates a collider with a triangle mesh shape defined by its vertex and index buffers.
Note that the resulting collider will be hollow and have no interior. This makes it more prone to tunneling and other collision issues.
The CollisionMargin component can be used to add thickness to the shape if needed.
For thin shapes like triangle meshes, it can help improve collision stability and performance.
§Panics
Panics if the given vertex and index buffers do not contain any triangles, there are duplicate vertices, or if at least two adjacent triangles have opposite orientations.
Sourcepub fn try_trimesh(
vertices: Vec<Vector>,
indices: Vec<[u32; 3]>,
) -> Result<Self, TrimeshBuilderError>
pub fn try_trimesh( vertices: Vec<Vector>, indices: Vec<[u32; 3]>, ) -> Result<Self, TrimeshBuilderError>
Tries to create a collider with a triangle mesh shape defined by its vertex and index buffers.
Note that the resulting collider will be hollow and have no interior. This makes it more prone to tunneling and other collision issues.
The CollisionMargin component can be used to add thickness to the shape if needed.
For thin shapes like triangle meshes, it can help improve collision stability and performance.
§Errors
Returns a TrimeshBuilderError if the given vertex and index buffers do not contain any triangles,
there are duplicate vertices, or if at least two adjacent triangles have opposite orientations.
Sourcepub fn trimesh_with_config(
vertices: Vec<Vector>,
indices: Vec<[u32; 3]>,
flags: TrimeshFlags,
) -> Self
pub fn trimesh_with_config( vertices: Vec<Vector>, indices: Vec<[u32; 3]>, flags: TrimeshFlags, ) -> Self
Creates a collider with a triangle mesh shape defined by its vertex and index buffers and flags controlling the preprocessing.
Note that the resulting collider will be hollow and have no interior. This makes it more prone to tunneling and other collision issues.
The CollisionMargin component can be used to add thickness to the shape if needed.
For thin shapes like triangle meshes, it can help improve collision stability and performance.
§Panics
Panics if after preprocessing the given vertex and index buffers do not contain any triangles, there are duplicate vertices, or if at least two adjacent triangles have opposite orientations.
Sourcepub fn try_trimesh_with_config(
vertices: Vec<Vector>,
indices: Vec<[u32; 3]>,
flags: TrimeshFlags,
) -> Result<Self, TrimeshBuilderError>
pub fn try_trimesh_with_config( vertices: Vec<Vector>, indices: Vec<[u32; 3]>, flags: TrimeshFlags, ) -> Result<Self, TrimeshBuilderError>
Tries to create a collider with a triangle mesh shape defined by its vertex and index buffers and flags controlling the preprocessing.
Note that the resulting collider will be hollow and have no interior. This makes it more prone to tunneling and other collision issues.
The CollisionMargin component can be used to add thickness to the shape if needed.
For thin shapes like triangle meshes, it can help improve collision stability and performance.
§Errors
Returns a TrimeshBuilderError if after preprocessing the given vertex and index buffers do not contain any triangles,
there are duplicate vertices, or if at least two adjacent triangles have opposite orientations.
Sourcepub fn convex_decomposition(
vertices: Vec<Vector>,
indices: Vec<[u32; 3]>,
) -> Self
pub fn convex_decomposition( vertices: Vec<Vector>, indices: Vec<[u32; 3]>, ) -> Self
Creates a collider shape with a compound shape obtained from the decomposition of a given trimesh defined by its vertex and index buffers.
Sourcepub fn convex_decomposition_with_config(
vertices: Vec<Vector>,
indices: Vec<[u32; 3]>,
params: VhacdParameters,
) -> Self
pub fn convex_decomposition_with_config( vertices: Vec<Vector>, indices: Vec<[u32; 3]>, params: VhacdParameters, ) -> Self
Creates a collider shape with a compound shape obtained from the decomposition of a given trimesh
defined by its vertex and index buffers. The given VhacdParameters are used for configuring
the decomposition process.
Sourcepub fn convex_hull(points: Vec<Vector>) -> Option<Self>
pub fn convex_hull(points: Vec<Vector>) -> Option<Self>
Creates a collider with a convex polyhedron shape obtained after computing the convex hull of the given points.
Sourcepub fn voxels(voxel_size: Vector, grid_coordinates: &[IVector]) -> Self
pub fn voxels(voxel_size: Vector, grid_coordinates: &[IVector]) -> Self
Creates a collider shape made of voxels.
Each voxel has the size voxel_size and grid coordinate given by grid_coordinates.
Sourcepub fn voxels_from_points(voxel_size: Vector, points: &[Vector]) -> Self
pub fn voxels_from_points(voxel_size: Vector, points: &[Vector]) -> Self
Creates a collider shape made of voxels.
Each voxel has the size voxel_size and contains at least one point from points.
Sourcepub fn voxelized_trimesh(
vertices: &[Vector],
indices: &[[u32; 3]],
voxel_size: Scalar,
fill_mode: FillMode,
) -> Self
pub fn voxelized_trimesh( vertices: &[Vector], indices: &[[u32; 3]], voxel_size: Scalar, fill_mode: FillMode, ) -> Self
Creates a voxel collider obtained from the decomposition of the given trimesh into voxelized convex parts.
Sourcepub fn voxelized_convex_decomposition(
vertices: &[Vector],
indices: &[[u32; 3]],
) -> Vec<Self>
pub fn voxelized_convex_decomposition( vertices: &[Vector], indices: &[[u32; 3]], ) -> Vec<Self>
Creates a collider with a compound shape obtained from the decomposition of the given trimesh into voxelized convex parts.
Sourcepub fn voxelized_convex_decomposition_with_config(
vertices: &[Vector],
indices: &[[u32; 3]],
parameters: &VhacdParameters,
) -> Vec<Self>
pub fn voxelized_convex_decomposition_with_config( vertices: &[Vector], indices: &[[u32; 3]], parameters: &VhacdParameters, ) -> Vec<Self>
Creates a collider with a compound shape obtained from the decomposition of the given trimesh into voxelized convex parts.
Sourcepub fn heightfield(heights: Vec<Vec<Scalar>>, scale: Vector) -> Self
pub fn heightfield(heights: Vec<Vec<Scalar>>, scale: Vector) -> Self
Creates a collider with a heightfield shape.
A 3D heightfield is a rectangle on the XZ plane, subdivided in a grid pattern at regular intervals.
heights is a matrix indicating the altitude of each subdivision point. The number of rows indicates
the number of subdivisions along the X axis, while the number of columns indicates the number of
subdivisions along the Z axis.
scale controls the scaling factor along each axis.
Sourcepub fn try_from_constructor(
collider_constructor: ColliderConstructor,
) -> Option<Self>
pub fn try_from_constructor( collider_constructor: ColliderConstructor, ) -> Option<Self>
Attempts to create a collider with the given ColliderConstructor.
By using this, you can serialize and deserialize the collider’s creation method
separately from the collider itself via the ColliderConstructor enum.
Returns None if creating the collider from the given ColliderConstructor failed.
Trait Implementations§
Source§impl AnyCollider for Collider
impl AnyCollider for Collider
Source§fn aabb_with_context(
&self,
position: Vector,
rotation: impl Into<Rotation>,
_: AabbContext<'_, '_, '_, Self::Context>,
) -> ColliderAabb
fn aabb_with_context( &self, position: Vector, rotation: impl Into<Rotation>, _: AabbContext<'_, '_, '_, Self::Context>, ) -> ColliderAabb
Source§fn contact_manifolds_with_context(
&self,
other: &Self,
position1: Vector,
rotation1: impl Into<Rotation>,
position2: Vector,
rotation2: impl Into<Rotation>,
prediction_distance: Scalar,
manifolds: &mut Vec<ContactManifold>,
_: ContactManifoldContext<'_, '_, '_, Self::Context>,
)
fn contact_manifolds_with_context( &self, other: &Self, position1: Vector, rotation1: impl Into<Rotation>, position2: Vector, rotation2: impl Into<Rotation>, prediction_distance: Scalar, manifolds: &mut Vec<ContactManifold>, _: ContactManifoldContext<'_, '_, '_, Self::Context>, )
ContactManifolds between two colliders. Read moreSource§fn swept_aabb_with_context(
&self,
start_position: Vector,
start_rotation: impl Into<Rotation>,
end_position: Vector,
end_rotation: impl Into<Rotation>,
context: AabbContext<'_, '_, '_, Self::Context>,
) -> ColliderAabb
fn swept_aabb_with_context( &self, start_position: Vector, start_rotation: impl Into<Rotation>, end_position: Vector, end_rotation: impl Into<Rotation>, context: AabbContext<'_, '_, '_, Self::Context>, ) -> ColliderAabb
Source§impl Component for Collider
Required Components: ColliderMarker, ColliderAabb, CollisionLayers, ColliderDensity, ColliderMassProperties.
impl Component for Collider
Required Components: ColliderMarker, ColliderAabb, CollisionLayers, ColliderDensity, ColliderMassProperties.
A component’s Required Components are inserted whenever it is inserted. Note that this will also insert the required components of the required components, recursively, in depth-first order.
Source§const STORAGE_TYPE: StorageType = ::bevy::ecs::component::StorageType::Table
const STORAGE_TYPE: StorageType = ::bevy::ecs::component::StorageType::Table
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 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_replace() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>
fn on_replace() -> 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§impl ComputeMassProperties3d for Collider
impl ComputeMassProperties3d for Collider
Source§fn unit_principal_angular_inertia(&self) -> Vec3
fn unit_principal_angular_inertia(&self) -> Vec3
1.0.Source§fn principal_angular_inertia(&self, mass: f32) -> Vec3
fn principal_angular_inertia(&self, mass: f32) -> Vec3
Source§fn local_inertial_frame(&self) -> Quat
fn local_inertial_frame(&self) -> Quat
Source§fn center_of_mass(&self) -> Vec3
fn center_of_mass(&self) -> Vec3
Source§fn mass_properties(&self, density: f32) -> MassProperties
fn mass_properties(&self, density: f32) -> MassProperties
MassProperties3d with a given density.Source§fn unit_angular_inertia_tensor(&self) -> AngularInertiaTensor
fn unit_angular_inertia_tensor(&self) -> AngularInertiaTensor
AngularInertiaTensor corresponding to a mass of 1.0.Source§fn angular_inertia_tensor(&self, mass: f32) -> AngularInertiaTensor
fn angular_inertia_tensor(&self, mass: f32) -> AngularInertiaTensor
AngularInertiaTensor corresponding to the given mass.Source§fn from(value: SharedShape) -> Self
fn from(value: SharedShape) -> Self
Source§impl IntoCollider<Collider> for Capsule3d
impl IntoCollider<Collider> for Capsule3d
Source§impl IntoCollider<Collider> for Cone
impl IntoCollider<Collider> for Cone
Source§impl IntoCollider<Collider> for Cuboid
impl IntoCollider<Collider> for Cuboid
Source§impl IntoCollider<Collider> for Cylinder
impl IntoCollider<Collider> for Cylinder
Source§impl IntoCollider<Collider> for InfinitePlane3d
impl IntoCollider<Collider> for InfinitePlane3d
Source§impl IntoCollider<Collider> for Line3d
impl IntoCollider<Collider> for Line3d
Source§impl IntoCollider<Collider> for Plane3d
impl IntoCollider<Collider> for Plane3d
Source§impl IntoCollider<Collider> for Polyline3d
impl IntoCollider<Collider> for Polyline3d
Source§impl IntoCollider<Collider> for Segment3d
impl IntoCollider<Collider> for Segment3d
Source§impl IntoCollider<Collider> for Sphere
impl IntoCollider<Collider> for Sphere
Auto Trait Implementations§
impl Freeze for Collider
impl !RefUnwindSafe for Collider
impl Send for Collider
impl Sync for Collider
impl Unpin for Collider
impl !UnwindSafe for Collider
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<'_>, ids: &mut impl FnMut(ComponentId), )
Source§fn get_component_ids(
components: &Components,
ids: &mut impl FnMut(Option<ComponentId>),
)
fn get_component_ids( components: &Components, ids: &mut impl FnMut(Option<ComponentId>), )
Source§impl<C> BundleFromComponents for Cwhere
C: Component,
impl<C> BundleFromComponents for Cwhere
C: Component,
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<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<C> SimpleCollider for Cwhere
C: AnyCollider<Context = ()>,
impl<C> SimpleCollider for Cwhere
C: AnyCollider<Context = ()>,
Source§fn aabb(&self, position: Vector, rotation: impl Into<Rotation>) -> ColliderAabb
fn aabb(&self, position: Vector, rotation: impl Into<Rotation>) -> ColliderAabb
Source§fn swept_aabb(
&self,
start_position: Vector,
start_rotation: impl Into<Rotation>,
end_position: Vector,
end_rotation: impl Into<Rotation>,
) -> ColliderAabb
fn swept_aabb( &self, start_position: Vector, start_rotation: impl Into<Rotation>, end_position: Vector, end_rotation: impl Into<Rotation>, ) -> ColliderAabb
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.