pub struct Collider {
pub raw: SharedShape,
/* private fields */
}Expand description
A geometric entity that can be attached to a RigidBody so it can be affected by contacts
and intersection queries.
Related components:
Fields§
§raw: SharedShapeThe raw shape from Rapier.
Implementations§
Source§impl Collider
impl Collider
Sourcepub fn promote_scaled_shape(&mut self)
pub fn promote_scaled_shape(&mut self)
This replaces the unscaled version of this collider by its scaled version,
and resets self.scale() to 1.0.
Sourcepub fn compound(shapes: Vec<(Vect, Rot, Collider)>) -> Self
pub fn compound(shapes: Vec<(Vect, Rot, Collider)>) -> Self
Initialize a new collider with a compound shape.
Sourcepub fn compound_with_flags(
shapes: Vec<(Vect, Rot, Collider)>,
flags: CompoundFlags,
weld_tolerance: Option<Real>,
) -> Self
pub fn compound_with_flags( shapes: Vec<(Vect, Rot, Collider)>, flags: CompoundFlags, weld_tolerance: Option<Real>, ) -> Self
Initialize a new collider with a compound shape and flags controlling its optional pre-processing.
weld_tolerance is the distance (in ULPs) under which two corners of different parts
are considered equal when detecting internal edges; None selects parry’s default.
Sourcepub fn ball(radius: Real) -> Self
pub fn ball(radius: Real) -> Self
Initialize a new collider with a ball shape defined by its radius.
Sourcepub fn halfspace(outward_normal: Vect) -> Option<Self>
pub fn halfspace(outward_normal: Vect) -> Option<Self>
Initialize a new collider build with a half-space shape defined by the outward normal of its planar boundary.
Sourcepub fn cuboid(half_x: Real, half_y: Real) -> Self
pub fn cuboid(half_x: Real, half_y: Real) -> Self
Initialize a new collider with a cuboid shape defined by its half-extents.
Sourcepub fn round_cuboid(half_x: Real, half_y: Real, border_radius: Real) -> Self
pub fn round_cuboid(half_x: Real, half_y: Real, border_radius: Real) -> Self
Initialize a new collider with a round cuboid shape defined by its half-extents and border radius.
Sourcepub fn capsule(start: Vect, end: Vect, radius: Real) -> Self
pub fn capsule(start: Vect, end: Vect, radius: Real) -> Self
Initialize a new collider with a capsule shape.
Sourcepub fn capsule_x(half_height: Real, radius: Real) -> Self
pub fn capsule_x(half_height: Real, radius: Real) -> Self
Initialize a new collider with a capsule shape aligned with the x axis.
Sourcepub fn capsule_y(half_height: Real, radius: Real) -> Self
pub fn capsule_y(half_height: Real, radius: Real) -> Self
Initialize a new collider with a capsule shape aligned with the y axis.
Sourcepub fn triangle(a: Vect, b: Vect, c: Vect) -> Self
pub fn triangle(a: Vect, b: Vect, c: Vect) -> Self
Initializes a collider with a triangle shape.
Sourcepub fn round_triangle(a: Vect, b: Vect, c: Vect, border_radius: Real) -> Self
pub fn round_triangle(a: Vect, b: Vect, c: Vect, border_radius: Real) -> Self
Initializes a collider with a triangle shape with round corners.
Sourcepub fn voxels(voxel_size: Vect, grid_coordinates: &[IVect]) -> Self
pub fn voxels(voxel_size: Vect, grid_coordinates: &[IVect]) -> Self
Initializes a shape made of voxels.
Each voxel has the size voxel_size and grid coordinate given by grid_coords.
The primitive_geometry controls the behavior of collision detection at voxels boundaries.
For initializing a voxels shape from points in space, see Self::voxels_from_points.
For initializing a voxels shape from a mesh to voxelize, see Self::voxelized_mesh.
For initializing multiple voxels shape from the convex decomposition of a mesh, see
Self::voxelized_convex_decomposition.
Sourcepub fn voxels_from_points(voxel_size: Vect, points: &[Vect]) -> Self
pub fn voxels_from_points(voxel_size: Vect, points: &[Vect]) -> Self
Initializes a shape made of voxels.
Each voxel has the size voxel_size and contains at least one point from centers.
The primitive_geometry controls the behavior of collision detection at voxels boundaries.
Sourcepub fn voxelized_mesh(
vertices: &[Vect],
indices: &[[u32; 2]],
voxel_size: Real,
fill_mode: FillMode,
) -> Self
pub fn voxelized_mesh( vertices: &[Vect], indices: &[[u32; 2]], voxel_size: Real, fill_mode: FillMode, ) -> Self
Initializes a voxels shape obtained from the decomposition of the given trimesh (in 3D) or polyline (in 2D) into voxelized convex parts.
Sourcepub fn voxelized_convex_decomposition(
vertices: &[Vect],
indices: &[[u32; 2]],
) -> Vec<Self>
pub fn voxelized_convex_decomposition( vertices: &[Vect], indices: &[[u32; 2]], ) -> Vec<Self>
Initializes a compound shape obtained from the decomposition of the given trimesh (in 3D) or polyline (in 2D) into voxelized convex parts.
Sourcepub fn voxelized_convex_decomposition_with_params(
vertices: &[Vect],
indices: &[[u32; 2]],
params: &VHACDParameters,
) -> Vec<Self>
pub fn voxelized_convex_decomposition_with_params( vertices: &[Vect], indices: &[[u32; 2]], params: &VHACDParameters, ) -> Vec<Self>
Initializes a compound shape obtained from the decomposition of the given trimesh (in 3D) or polyline (in 2D) into voxelized convex parts.
Sourcepub fn polyline(vertices: Vec<Vect>, indices: Option<Vec<[u32; 2]>>) -> Self
pub fn polyline(vertices: Vec<Vect>, indices: Option<Vec<[u32; 2]>>) -> Self
Initializes a collider with a polyline shape defined by its vertex and index buffers.
Sourcepub fn polyline_with_flags(
vertices: Vec<Vect>,
indices: Option<Vec<[u32; 2]>>,
flags: PolylineFlags,
) -> Self
pub fn polyline_with_flags( vertices: Vec<Vect>, indices: Option<Vec<[u32; 2]>>, flags: PolylineFlags, ) -> Self
Initializes a collider with a polyline shape defined by its vertex and index buffers, and flags controlling its optional associated data (orientation, deformability).
Sourcepub fn oriented_polyline(
vertices: Vec<Vect>,
indices: Option<Vec<[u32; 2]>>,
) -> Self
pub fn oriented_polyline( vertices: Vec<Vect>, indices: Option<Vec<[u32; 2]>>, ) -> Self
Initializes a collider with a one-sided (oriented) polyline shape.
The segments only collide from their outward side, which is on the right of each segment’s direction: a counter-clockwise loop has a solid interior.
Sourcepub fn trimesh(
vertices: Vec<Vect>,
indices: Vec<[u32; 3]>,
) -> Result<Self, TriMeshBuilderError>
pub fn trimesh( vertices: Vec<Vect>, indices: Vec<[u32; 3]>, ) -> Result<Self, TriMeshBuilderError>
Initializes a collider with a triangle mesh shape defined by its vertex and index buffers.
Sourcepub fn trimesh_with_flags(
vertices: Vec<Vect>,
indices: Vec<[u32; 3]>,
flags: TriMeshFlags,
) -> Result<Self, TriMeshBuilderError>
pub fn trimesh_with_flags( vertices: Vec<Vect>, indices: Vec<[u32; 3]>, flags: TriMeshFlags, ) -> Result<Self, TriMeshBuilderError>
Initializes a collider with a triangle mesh shape defined by its vertex and index buffers, and flags controlling its pre-processing.
Sourcepub fn converted_trimesh(
vertices: Vec<Vect>,
indices: Vec<[u32; 3]>,
converter: MeshConverter,
) -> Result<Self, MeshConverterError>
pub fn converted_trimesh( vertices: Vec<Vect>, indices: Vec<[u32; 3]>, converter: MeshConverter, ) -> Result<Self, MeshConverterError>
Initializes a collider with a shape converted from the given triangle mesh vertex and
index buffers, following the conversion rule described by converter.
Conversions yielding a shape offset from the mesh origin (MeshConverter::Obb and
MeshConverter::Aabb) are wrapped into a single-part compound shape to keep that offset.
Sourcepub fn convex_decomposition(vertices: &[Vect], indices: &[[u32; 2]]) -> Self
pub fn convex_decomposition(vertices: &[Vect], indices: &[[u32; 2]]) -> Self
Initializes a collider with a compound shape obtained from the decomposition of the given trimesh (in 3D) or polyline (in 2D) into convex parts.
Sourcepub fn round_convex_decomposition(
vertices: &[Vect],
indices: &[[u32; 2]],
border_radius: Real,
) -> Self
pub fn round_convex_decomposition( vertices: &[Vect], indices: &[[u32; 2]], border_radius: Real, ) -> Self
Initializes a collider with a compound shape obtained from the decomposition of the given trimesh (in 3D) or polyline (in 2D) into convex parts dilated with round corners.
Sourcepub fn convex_decomposition_with_params(
vertices: &[Vect],
indices: &[[u32; 2]],
params: &VHACDParameters,
) -> Self
pub fn convex_decomposition_with_params( vertices: &[Vect], indices: &[[u32; 2]], params: &VHACDParameters, ) -> Self
Initializes a collider with a compound shape obtained from the decomposition of the given trimesh (in 3D) or polyline (in 2D) into convex parts.
Sourcepub fn round_convex_decomposition_with_params(
vertices: &[Vect],
indices: &[[u32; 2]],
params: &VHACDParameters,
border_radius: Real,
) -> Self
pub fn round_convex_decomposition_with_params( vertices: &[Vect], indices: &[[u32; 2]], params: &VHACDParameters, border_radius: Real, ) -> Self
Initializes a collider with a compound shape obtained from the decomposition of the given trimesh (in 3D) or polyline (in 2D) into convex parts dilated with round corners.
Sourcepub fn convex_hull(points: &[Vect]) -> Option<Self>
pub fn convex_hull(points: &[Vect]) -> Option<Self>
Initializes a new collider with a 2D convex polygon or 3D convex polyhedron obtained after computing the convex-hull of the given points.
Sourcepub fn round_convex_hull(points: &[Vect], border_radius: Real) -> Option<Self>
pub fn round_convex_hull(points: &[Vect], border_radius: Real) -> Option<Self>
Initializes a new collider with a round 2D convex polygon or 3D convex polyhedron
obtained after computing the convex-hull of the given points. The shape is dilated
by a sphere of radius border_radius.
Sourcepub fn convex_polyline(points: Vec<Vect>) -> Option<Self>
pub fn convex_polyline(points: Vec<Vect>) -> Option<Self>
Creates a new collider that is a convex polygon formed by the given polyline assumed to be convex (no convex-hull will be automatically computed).
Sourcepub fn convex_polyline_unmodified(points: Vec<Vect>) -> Option<Self>
pub fn convex_polyline_unmodified(points: Vec<Vect>) -> Option<Self>
Creates a new collider that is a convex polygon formed by the given polyline assumed to be convex and counter-clockwise.
Unlike Self::convex_polyline, no point is removed from the input even if some are
collinear. Returns None if points contains less than three points.
Sourcepub fn round_convex_polyline(
points: Vec<Vect>,
border_radius: Real,
) -> Option<Self>
pub fn round_convex_polyline( points: Vec<Vect>, border_radius: Real, ) -> Option<Self>
Creates a new collider that is a round convex polygon formed by the
given polyline assumed to be convex (no convex-hull will be automatically
computed). The polygon shape is dilated by a sphere of radius border_radius.
Sourcepub fn heightfield(heights: Vec<Real>, scale: Vect) -> Self
pub fn heightfield(heights: Vec<Real>, scale: Vect) -> Self
Initializes a collider with a heightfield shape defined by its set of height and a scale factor along each coordinate axis.
Sourcepub fn as_typed_shape(&self) -> ColliderView<'_>
pub fn as_typed_shape(&self) -> ColliderView<'_>
Takes a strongly typed reference of this collider.
Sourcepub fn as_unscaled_typed_shape(&self) -> ColliderView<'_>
pub fn as_unscaled_typed_shape(&self) -> ColliderView<'_>
Takes a strongly typed reference of the unscaled version of this collider.
Sourcepub fn as_cuboid(&self) -> Option<CuboidView<'_>>
pub fn as_cuboid(&self) -> Option<CuboidView<'_>>
Downcast this collider to a cuboid, if it is one.
Sourcepub fn as_capsule(&self) -> Option<CapsuleView<'_>>
pub fn as_capsule(&self) -> Option<CapsuleView<'_>>
Downcast this collider to a capsule, if it is one.
Sourcepub fn as_segment(&self) -> Option<SegmentView<'_>>
pub fn as_segment(&self) -> Option<SegmentView<'_>>
Downcast this collider to a segment, if it is one.
Sourcepub fn as_triangle(&self) -> Option<TriangleView<'_>>
pub fn as_triangle(&self) -> Option<TriangleView<'_>>
Downcast this collider to a triangle, if it is one.
Sourcepub fn as_voxels(&self) -> Option<VoxelsView<'_>>
pub fn as_voxels(&self) -> Option<VoxelsView<'_>>
Downcast this collider to a voxels, if it is one.
Sourcepub fn as_trimesh(&self) -> Option<TriMeshView<'_>>
pub fn as_trimesh(&self) -> Option<TriMeshView<'_>>
Downcast this collider to a triangle mesh, if it is one.
Sourcepub fn as_polyline(&self) -> Option<PolylineView<'_>>
pub fn as_polyline(&self) -> Option<PolylineView<'_>>
Downcast this collider to a polyline, if it is one.
Sourcepub fn as_halfspace(&self) -> Option<HalfSpaceView<'_>>
pub fn as_halfspace(&self) -> Option<HalfSpaceView<'_>>
Downcast this collider to a half-space, if it is one.
Sourcepub fn as_heightfield(&self) -> Option<HeightFieldView<'_>>
pub fn as_heightfield(&self) -> Option<HeightFieldView<'_>>
Downcast this collider to a heightfield, if it is one.
Sourcepub fn as_compound(&self) -> Option<CompoundView<'_>>
pub fn as_compound(&self) -> Option<CompoundView<'_>>
Downcast this collider to a compound shape, if it is one.
Sourcepub fn as_convex_polygon(&self) -> Option<ConvexPolygonView<'_>>
pub fn as_convex_polygon(&self) -> Option<ConvexPolygonView<'_>>
Downcast this collider to a convex polygon, if it is one.
Sourcepub fn as_ball_mut(&mut self) -> Option<BallViewMut<'_>>
pub fn as_ball_mut(&mut self) -> Option<BallViewMut<'_>>
Downcast this collider to a mutable ball, if it is one.
Sourcepub fn as_cuboid_mut(&mut self) -> Option<CuboidViewMut<'_>>
pub fn as_cuboid_mut(&mut self) -> Option<CuboidViewMut<'_>>
Downcast this collider to a mutable cuboid, if it is one.
Sourcepub fn as_capsule_mut(&mut self) -> Option<CapsuleViewMut<'_>>
pub fn as_capsule_mut(&mut self) -> Option<CapsuleViewMut<'_>>
Downcast this collider to a mutable capsule, if it is one.
Sourcepub fn as_segment_mut(&mut self) -> Option<SegmentViewMut<'_>>
pub fn as_segment_mut(&mut self) -> Option<SegmentViewMut<'_>>
Downcast this collider to a mutable segment, if it is one.
Sourcepub fn as_triangle_mut(&mut self) -> Option<TriangleViewMut<'_>>
pub fn as_triangle_mut(&mut self) -> Option<TriangleViewMut<'_>>
Downcast this collider to a mutable triangle, if it is one.
Sourcepub fn as_voxels_mut(&mut self) -> Option<VoxelsViewMut<'_>>
pub fn as_voxels_mut(&mut self) -> Option<VoxelsViewMut<'_>>
Downcast this collider to a mutable voxels, if it is one.
Sourcepub fn as_trimesh_mut(&mut self) -> Option<TriMeshViewMut<'_>>
pub fn as_trimesh_mut(&mut self) -> Option<TriMeshViewMut<'_>>
Downcast this collider to a mutable triangle mesh, if it is one.
Sourcepub fn as_polyline_mut(&mut self) -> Option<PolylineViewMut<'_>>
pub fn as_polyline_mut(&mut self) -> Option<PolylineViewMut<'_>>
Downcast this collider to a mutable polyline, if it is one.
Sourcepub fn as_halfspace_mut(&mut self) -> Option<HalfSpaceViewMut<'_>>
pub fn as_halfspace_mut(&mut self) -> Option<HalfSpaceViewMut<'_>>
Downcast this collider to a mutable half-space, if it is one.
Sourcepub fn as_heightfield_mut(&mut self) -> Option<HeightFieldViewMut<'_>>
pub fn as_heightfield_mut(&mut self) -> Option<HeightFieldViewMut<'_>>
Downcast this collider to a mutable heightfield, if it is one.
Sourcepub fn as_compound_mut(&mut self) -> Option<CompoundViewMut<'_>>
pub fn as_compound_mut(&mut self) -> Option<CompoundViewMut<'_>>
Downcast this collider to a mutable compound shape, if it is one.
Like the other mutable downcasts, this clones the shape first if it is shared with other colliders. The parts of the compound remain shared.
Sourcepub fn set_scale(&mut self, scale: Vect, num_subdivisions: u32)
pub fn set_scale(&mut self, scale: Vect, num_subdivisions: u32)
Set the scaling factor of this shape.
If the scaling factor is non-uniform, and the scaled shape can’t be
represented as a supported smooth shape (for example scalling a Ball
with a non-uniform scale results in an ellipse which isn’t supported),
the shape is approximated by a convex polygon/convex polyhedron using
num_subdivisions subdivisions.
Sourcepub fn project_local_point_with_max_dist(
&self,
point: Vect,
solid: bool,
max_dist: Real,
) -> Option<PointProjection>
pub fn project_local_point_with_max_dist( &self, point: Vect, solid: bool, max_dist: Real, ) -> Option<PointProjection>
Projects a point on self, unless the projection lies further than the given max distance.
The point is assumed to be expressed in the local-space of self.
Sourcepub fn project_point_with_max_dist(
&self,
translation: Vect,
rotation: Rot,
point: Vect,
solid: bool,
max_dist: Real,
) -> Option<PointProjection>
pub fn project_point_with_max_dist( &self, translation: Vect, rotation: Rot, point: Vect, solid: bool, max_dist: Real, ) -> Option<PointProjection>
Projects a point on self transformed by m, unless the projection lies further than the given max distance.
Sourcepub fn project_local_point(&self, point: Vect, solid: bool) -> PointProjection
pub fn project_local_point(&self, point: Vect, solid: bool) -> PointProjection
Projects a point on self.
The point is assumed to be expressed in the local-space of self.
Sourcepub fn project_local_point_and_get_feature(
&self,
point: Vect,
) -> (PointProjection, FeatureId)
pub fn project_local_point_and_get_feature( &self, point: Vect, ) -> (PointProjection, FeatureId)
Projects a point on the boundary of self and returns the id of the
feature the point was projected on.
Sourcepub fn distance_to_local_point(&self, point: Vect, solid: bool) -> Real
pub fn distance_to_local_point(&self, point: Vect, solid: bool) -> Real
Computes the minimal distance between a point and self.
Sourcepub fn contains_local_point(&self, point: Vect) -> bool
pub fn contains_local_point(&self, point: Vect) -> bool
Tests if the given point is inside of self.
Sourcepub fn project_point(
&self,
translation: Vect,
rotation: Rot,
point: Vect,
solid: bool,
) -> PointProjection
pub fn project_point( &self, translation: Vect, rotation: Rot, point: Vect, solid: bool, ) -> PointProjection
Projects a point on self transformed by m.
Sourcepub fn distance_to_point(
&self,
translation: Vect,
rotation: Rot,
point: Vect,
solid: bool,
) -> Real
pub fn distance_to_point( &self, translation: Vect, rotation: Rot, point: Vect, solid: bool, ) -> Real
Computes the minimal distance between a point and self transformed by m.
Sourcepub fn project_point_and_get_feature(
&self,
translation: Vect,
rotation: Rot,
point: Vect,
) -> (PointProjection, FeatureId)
pub fn project_point_and_get_feature( &self, translation: Vect, rotation: Rot, point: Vect, ) -> (PointProjection, FeatureId)
Projects a point on the boundary of self transformed by m and returns the id of the
feature the point was projected on.
Sourcepub fn contains_point(
&self,
translation: Vect,
rotation: Rot,
point: Vect,
) -> bool
pub fn contains_point( &self, translation: Vect, rotation: Rot, point: Vect, ) -> bool
Tests if the given point is inside of self transformed by m.
Sourcepub fn cast_local_ray(
&self,
ray_origin: Vect,
ray_dir: Vect,
max_time_of_impact: Real,
solid: bool,
) -> Option<Real>
pub fn cast_local_ray( &self, ray_origin: Vect, ray_dir: Vect, max_time_of_impact: Real, solid: bool, ) -> Option<Real>
Computes the time of impact between this transform shape and a ray.
Sourcepub fn cast_local_ray_and_get_normal(
&self,
ray_origin: Vect,
ray_dir: Vect,
max_time_of_impact: Real,
solid: bool,
) -> Option<RayIntersection>
pub fn cast_local_ray_and_get_normal( &self, ray_origin: Vect, ray_dir: Vect, max_time_of_impact: Real, solid: bool, ) -> Option<RayIntersection>
Computes the time of impact, and normal between this transformed shape and a ray.
Sourcepub fn intersects_local_ray(
&self,
ray_origin: Vect,
ray_dir: Vect,
max_time_of_impact: Real,
) -> bool
pub fn intersects_local_ray( &self, ray_origin: Vect, ray_dir: Vect, max_time_of_impact: Real, ) -> bool
Tests whether a ray intersects this transformed shape.
Sourcepub fn cast_ray(
&self,
translation: Vect,
rotation: Rot,
ray_origin: Vect,
ray_dir: Vect,
max_time_of_impact: Real,
solid: bool,
) -> Option<Real>
pub fn cast_ray( &self, translation: Vect, rotation: Rot, ray_origin: Vect, ray_dir: Vect, max_time_of_impact: Real, solid: bool, ) -> Option<Real>
Computes the time of impact between this transform shape and a ray.
Sourcepub fn cast_ray_and_get_normal(
&self,
translation: Vect,
rotation: Rot,
ray_origin: Vect,
ray_dir: Vect,
max_time_of_impact: Real,
solid: bool,
) -> Option<RayIntersection>
pub fn cast_ray_and_get_normal( &self, translation: Vect, rotation: Rot, ray_origin: Vect, ray_dir: Vect, max_time_of_impact: Real, solid: bool, ) -> Option<RayIntersection>
Computes the time of impact, and normal between this transformed shape and a ray.
Sourcepub fn intersects_ray(
&self,
translation: Vect,
rotation: Rot,
ray_origin: Vect,
ray_dir: Vect,
max_time_of_impact: Real,
) -> bool
pub fn intersects_ray( &self, translation: Vect, rotation: Rot, ray_origin: Vect, ray_dir: Vect, max_time_of_impact: Real, ) -> bool
Tests whether a ray intersects this transformed shape.
Sourcepub fn aabb(&self, translation: Vect, rotation: Rot) -> BevyAabb
pub fn aabb(&self, translation: Vect, rotation: Rot) -> BevyAabb
Computes the axis-aligned bounding box of self transformed by the given translation
and rotation.
Sourcepub fn local_aabb(&self) -> BevyAabb
pub fn local_aabb(&self) -> BevyAabb
Computes the axis-aligned bounding box of self in its local-space.
Sourcepub fn bounding_sphere(
&self,
translation: Vect,
rotation: Rot,
) -> BevyBoundingSphere
pub fn bounding_sphere( &self, translation: Vect, rotation: Rot, ) -> BevyBoundingSphere
Computes a bounding sphere (or circle in 2D) of self transformed by the given
translation and rotation.
Sourcepub fn local_bounding_sphere(&self) -> BevyBoundingSphere
pub fn local_bounding_sphere(&self) -> BevyBoundingSphere
Computes a bounding sphere (or circle in 2D) of self in its local-space.
Sourcepub fn mass_properties(&self, density: Real) -> MassProperties
pub fn mass_properties(&self, density: Real) -> MassProperties
Computes the mass properties of self, assuming it has the given uniform density.
Sourcepub fn contact(
&self,
translation: Vect,
rotation: Rot,
other: &Collider,
other_translation: Vect,
other_rotation: Rot,
prediction: Real,
) -> Result<Option<ShapeContact>, Unsupported>
pub fn contact( &self, translation: Vect, rotation: Rot, other: &Collider, other_translation: Vect, other_rotation: Rot, prediction: Real, ) -> Result<Option<ShapeContact>, Unsupported>
Computes the contact between self and other, each transformed by their respective
translation and rotation.
Returns Ok(None) if the colliders are separated by more than prediction. The contact
points and normals are expressed in world-space.
Sourcepub fn distance(
&self,
translation: Vect,
rotation: Rot,
other: &Collider,
other_translation: Vect,
other_rotation: Rot,
) -> Result<Real, Unsupported>
pub fn distance( &self, translation: Vect, rotation: Rot, other: &Collider, other_translation: Vect, other_rotation: Rot, ) -> Result<Real, Unsupported>
Computes the minimal distance between self and other, each transformed by their
respective translation and rotation.
Returns 0.0 if the colliders are intersecting.
Sourcepub fn intersection_test(
&self,
translation: Vect,
rotation: Rot,
other: &Collider,
other_translation: Vect,
other_rotation: Rot,
) -> Result<bool, Unsupported>
pub fn intersection_test( &self, translation: Vect, rotation: Rot, other: &Collider, other_translation: Vect, other_rotation: Rot, ) -> Result<bool, Unsupported>
Tests whether self and other, each transformed by their respective translation and
rotation, are intersecting.
Sourcepub fn closest_points(
&self,
translation: Vect,
rotation: Rot,
other: &Collider,
other_translation: Vect,
other_rotation: Rot,
max_dist: Real,
) -> Result<ShapeClosestPoints, Unsupported>
pub fn closest_points( &self, translation: Vect, rotation: Rot, other: &Collider, other_translation: Vect, other_rotation: Rot, max_dist: Real, ) -> Result<ShapeClosestPoints, Unsupported>
Computes the closest points between self and other, each transformed by their
respective translation and rotation.
Returns ShapeClosestPoints::Disjoint if the colliders are separated by more than
max_dist. The closest points are expressed in world-space.
Sourcepub fn cast_shape(
&self,
translation: Vect,
rotation: Rot,
velocity: Vect,
other: &Collider,
other_translation: Vect,
other_rotation: Rot,
other_velocity: Vect,
options: ShapeCastOptions,
) -> Result<Option<ShapeCastHit>, Unsupported>
pub fn cast_shape( &self, translation: Vect, rotation: Rot, velocity: Vect, other: &Collider, other_translation: Vect, other_rotation: Rot, other_velocity: Vect, options: ShapeCastOptions, ) -> Result<Option<ShapeCastHit>, Unsupported>
Computes the first time of impact between self and other, each starting at their
respective translation and rotation, and moving with a constant linear velocity.
Returns Ok(None) if they do not hit within ShapeCastOptions::max_time_of_impact.
The witness points and normals of the result are expressed in the local-space of
each collider.
Sourcepub fn cast_shape_nonlinear(
&self,
motion: &NonlinearMotion,
other: &Collider,
other_motion: &NonlinearMotion,
start_time: Real,
end_time: Real,
stop_at_penetration: bool,
) -> Result<Option<ShapeCastHit>, Unsupported>
pub fn cast_shape_nonlinear( &self, motion: &NonlinearMotion, other: &Collider, other_motion: &NonlinearMotion, start_time: Real, end_time: Real, stop_at_penetration: bool, ) -> Result<Option<ShapeCastHit>, Unsupported>
Computes the first time of impact between self and other, each following a
nonlinear rigid motion (with both linear and angular velocities).
Only the time interval [start_time, end_time] is considered. If
stop_at_penetration is true and the colliders are initially penetrating, a hit
at start_time is returned. The witness points and normals of the result are
expressed in the local-space of each collider.
Trait Implementations§
Source§impl Component for Collider
Required Components: ReadColliderMassProperties.
impl Component for Collider
Required Components: ReadColliderMassProperties.
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 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§fn from(shared_shape: SharedShape) -> Collider
fn from(shared_shape: SharedShape) -> Collider
Auto Trait Implementations§
impl !RefUnwindSafe for Collider
impl !UnwindSafe for Collider
impl Freeze for Collider
impl Send for Collider
impl Sync for Collider
impl Unpin for Collider
impl UnsafeUnpin 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<'_>, ) -> 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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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> FromTemplate for T
impl<T> FromTemplate 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 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>
impl<T> MaybeSync 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.Source§impl<T> Template for T
impl<T> Template for T
Source§fn build_template(
&self,
_context: &mut TemplateContext<'_, '_>,
) -> Result<<T as Template>::Output, BevyError>
fn build_template( &self, _context: &mut TemplateContext<'_, '_>, ) -> Result<<T as Template>::Output, BevyError>
entity context to produce a Template::Output.Source§fn clone_template(&self) -> T
fn clone_template(&self) -> T
Clone.Source§impl<T> TypeData for T
impl<T> TypeData for T
Source§fn clone_type_data(&self) -> Box<dyn TypeData>
fn clone_type_data(&self) -> Box<dyn TypeData>
self.