Struct rhusics_core::CollisionShape[][src]

pub struct CollisionShape<P, T, B, Y = ()> where
    P: Primitive
{ pub enabled: bool, // some fields omitted }

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

Enable/Disable collision detection for this shape

Methods

impl<P, T, B, Y> CollisionShape<P, T, B, Y> where
    P: Primitive + ComputeBound<B>,
    B: Bound<Point = P::Point> + Union<B, Output = B> + Clone,
    T: Transform<P::Point>,
    Y: Default
[src]

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.

Important traits for &'a mut R

Return the current transformed bound for the shape

Important traits for Vec<u8>

Borrow the primitives of the shape

Trait Implementations

impl<P: Debug, T: Debug, B: Debug, Y: Debug> Debug for CollisionShape<P, T, B, Y> where
    P: Primitive
[src]

Formats the value using the given formatter. Read more

impl<P: Clone, T: Clone, B: Clone, Y: Clone> Clone for CollisionShape<P, T, B, Y> where
    P: Primitive
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl<P, T, B, Y> HasBound for CollisionShape<P, T, B, Y> where
    P: Primitive + ComputeBound<B>,
    B: Bound<Point = P::Point> + Union<B, Output = B> + Clone,
    T: Transform<P::Point>,
    Y: Default
[src]

Bounding volume type

Borrow the bounding volume

impl<S, P, T, B, Y> Volume<S, S> for CollisionShape<P, T, B, Y> where
    S: BaseFloat + Inertia,
    P: Volume<S, S> + Primitive<Point = Point2<S>> + ComputeBound<B>,
    B: Bound<Point = Point2<S>> + Clone + Union<B, Output = B>,
    T: Transform<Point2<S>>,
    Y: Default
[src]

Compute the mass of the shape based on its material

impl<S, P, T, B, Y> Volume<S, Matrix3<S>> for CollisionShape<P, T, B, Y> where
    S: BaseFloat,
    P: Volume<S, Matrix3<S>> + Primitive<Point = Point3<S>> + ComputeBound<B>,
    B: Bound<Point = Point3<S>> + Clone + Union<B, Output = B>,
    T: Transform<Point3<S>>,
    Y: Default
[src]

Compute the mass of the shape based on its material

Auto Trait Implementations

impl<P, T, B, Y> Send for CollisionShape<P, T, B, Y> where
    B: Send,
    P: Send,
    T: Send,
    Y: Send

impl<P, T, B, Y> Sync for CollisionShape<P, T, B, Y> where
    B: Sync,
    P: Sync,
    T: Sync,
    Y: Sync