ReactPhysics3D: reactphysics3d::CollisionShape Class Reference

| ReactPhysics3D v0.10.2 C++ Physics engine library

Loading...
Searching...
No Matches
Public Member Functions | List of all members
reactphysics3d::CollisionShape Class Referenceabstract

This abstract class represents the collision shape associated with a body that is used during the narrow-phase collision detection. More...

`#include <include/reactphysics3d/collision/shapes/CollisionShape.h>`

Inheritance diagram for reactphysics3d::CollisionShape:

## Public Member Functions
| CollisionShape (CollisionShapeName name, CollisionShapeType type, MemoryAllocator &allocator)
| Constructor.
virtual | ~CollisionShape ()=default
| Destructor.
| CollisionShape (const CollisionShape &shape)=delete
| Deleted copy-constructor.
CollisionShape & | operator= (const CollisionShape &shape)=delete
| Deleted assignment operator.
CollisionShapeName | getName () const
| Return the name of the collision shape.
CollisionShapeType | getType () const
| Return the type of the collision shape.
virtual bool | isConvex () const =0
| Return true if the collision shape is convex, false if it is concave.
virtual bool | isPolyhedron () const =0
| Return true if the collision shape is a polyhedron.
virtual AABB | getLocalBounds () const =0
| Return the local bounds of the shape in x, y and z directions.
uint32 | getId () const
| Return the id of the shape.
virtual Vector3 | getLocalInertiaTensor (decimal mass) const =0
| Return the local inertia tensor of the collision shapes.
virtual decimal | getVolume () const =0
| Compute and return the volume of the collision shape.
virtual AABB | computeTransformedAABB (const Transform &transform) const
| Compute the transformed AABB of the collision shape given a transform.
virtual std::string | to_string () const =0
| Return the string representation of the shape.

## Detailed Description

This abstract class represents the collision shape associated with a body that is used during the narrow-phase collision detection.

## Member Function Documentation

## ◆ computeTransformedAABB()

AABB CollisionShape::computeTransformedAABB | ( | const Transform & | transform | ) | const
| virtual

Compute the transformed AABB of the collision shape given a transform.

Parameters

  transform | Transform to use to for the space conversion

Returns
  The transformed axis-aligned bounding box (AABB) of the collision shape

Reimplemented in reactphysics3d::SphereShape, and reactphysics3d::TriangleShape.

## ◆ getLocalBounds()

virtual AABB reactphysics3d::CollisionShape::getLocalBounds | ( |  | ) | const
| pure virtual

Return the local bounds of the shape in x, y and z directions.

Implemented in reactphysics3d::BoxShape, reactphysics3d::CapsuleShape, reactphysics3d::ConcaveMeshShape, reactphysics3d::ConvexMeshShape, reactphysics3d::HeightFieldShape, reactphysics3d::SphereShape, and reactphysics3d::TriangleShape.

## ◆ getLocalInertiaTensor()

virtual Vector3 reactphysics3d::CollisionShape::getLocalInertiaTensor | ( | decimal | mass | ) | const
| pure virtual

Return the local inertia tensor of the collision shapes.

Implemented in reactphysics3d::BoxShape, reactphysics3d::CapsuleShape, reactphysics3d::ConcaveShape, reactphysics3d::ConvexMeshShape, reactphysics3d::SphereShape, and reactphysics3d::TriangleShape.

## ◆ getName()

RP3D_FORCE_INLINE CollisionShapeName reactphysics3d::CollisionShape::getName | ( |  | ) | const

Return the name of the collision shape.

Returns
  The name of the collision shape (box, sphere, triangle, ...)

## ◆ getType()

RP3D_FORCE_INLINE CollisionShapeType reactphysics3d::CollisionShape::getType | ( |  | ) | const

Return the type of the collision shape.

Returns
  The type of the collision shape (sphere, capsule, convex polyhedron, concave mesh)

## ◆ getVolume()

virtual decimal reactphysics3d::CollisionShape::getVolume | ( |  | ) | const
| pure virtual

Compute and return the volume of the collision shape.

Implemented in reactphysics3d::BoxShape, reactphysics3d::CapsuleShape, reactphysics3d::ConcaveShape, reactphysics3d::ConvexMeshShape, reactphysics3d::SphereShape, and reactphysics3d::TriangleShape.

## ◆ isConvex()

virtual bool reactphysics3d::CollisionShape::isConvex | ( |  | ) | const
| pure virtual

Return true if the collision shape is convex, false if it is concave.

Implemented in reactphysics3d::ConcaveShape, and reactphysics3d::ConvexShape.

## ◆ isPolyhedron()

virtual bool reactphysics3d::CollisionShape::isPolyhedron | ( |  | ) | const
| pure virtual

Return true if the collision shape is a polyhedron.

Implemented in reactphysics3d::CapsuleShape, reactphysics3d::ConcaveShape, reactphysics3d::ConvexPolyhedronShape, and reactphysics3d::SphereShape.

## ◆ to_string()

virtual std::string reactphysics3d::CollisionShape::to_string | ( |  | ) | const
| pure virtual

Return the string representation of the shape.

Implemented in reactphysics3d::BoxShape, reactphysics3d::CapsuleShape, reactphysics3d::ConcaveMeshShape, reactphysics3d::ConvexMeshShape, reactphysics3d::HeightFieldShape, reactphysics3d::SphereShape, and reactphysics3d::TriangleShape.

The documentation for this class was generated from the following files:

- include/reactphysics3d/collision/shapes/CollisionShape.h
- src/collision/shapes/CollisionShape.cpp