pub struct CollisionShape<P, T, B, Y = ()>where
    P: Primitive,
{ pub enabled: bool, /* private fields */ }
Expand description

Collision shape describing a complete collision object in the collision world.

Can handle both convex shapes, and concave shapes, by subdividing the concave shapes into multiple convex shapes. This task is up to the user of the library to perform, no subdivision is done automatically in the library.

Contains cached information about the base bounding box containing all primitives, in model space coordinates. Also contains a cached version of the transformed bounding box, in world space coordinates.

Also have details about what collision strategy/mode to use for contact resolution with this shape.

Type parameters:

  • P: Primitive type
  • T: Transform type
  • B: Bounding volume type
  • Y: Shape type (see Collider)

Fields

enabled: bool

Enable/Disable collision detection for this shape

Implementations

Create a new collision shape, with multiple collision primitives.

Will compute and cache the base bounding box that contains all the given primitives, in model space coordinates.

Parameters
  • strategy: The collision strategy to use for this shape.
  • primitives: List of all primitives that make up this shape.
  • ty: The shape type, use () if not needed

Convenience function to create a simple collision shape with only a single given primitive, with no local-to-model transform.

Parameters
  • strategy: The collision strategy to use for this shape.
  • primitive: The collision primitive.

Convenience function to create a simple collision shape with only a single given primitive, and a shape type, with no local-to-model transform.

Parameters
  • strategy: The collision strategy to use for this shape.
  • primitive: The collision primitive.

Convenience function to create a simple collision shape with only a single given primitive, with a given local-to-model transform.

Parameters
  • strategy: The collision strategy to use for this shape.
  • primitive: The collision primitive.
  • transform: Local-to-model transform of the primitive.

Update the cached transformed bounding box in world space coordinates.

If the end transform is given, that will always be used. If the collision mode of the shape is Continuous, both the start and end transforms will be added to the transformed bounding box. This will make broad phase detect collisions for the whole transformation path.

Parameters
  • start: Current model-to-world transform of the shape at the start of the frame.
  • end: Optional model-to-world transform of the shaped at the end of the frame.

Return the current transformed bound for the shape

Borrow the primitives of the shape

Trait Implementations

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
Bounding volume type
Borrow the bounding volume
Compute the mass of the shape based on its material
Compute the mass of the shape based on its material

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.