ReactPhysics3D: reactphysics3d::CapsuleShape Class Reference

| ReactPhysics3D v0.10.2 C++ Physics engine library

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

This class represents a capsule collision shape that is defined around the Y axis. More...

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

Inheritance diagram for reactphysics3d::CapsuleShape:

## Public Member Functions
| CapsuleShape (const CapsuleShape &shape)=delete
| Deleted copy-constructor.
CapsuleShape & | operator= (const CapsuleShape &shape)=delete
| Deleted assignment operator.
decimal | getRadius () const
| Return the radius of the capsule.
void | setRadius (decimal radius)
| Set the radius of the capsule.
decimal | getHeight () const
| Return the height of the capsule.
void | setHeight (decimal height)
| Set the height of the capsule.
virtual AABB | getLocalBounds () const override
| Return the local bounds of the shape in x, y and z directions.
virtual decimal | getVolume () const override
| Compute and return the volume of the collision shape.
virtual bool | isPolyhedron () const override
| Return true if the collision shape is a polyhedron.
virtual Vector3 | getLocalInertiaTensor (decimal mass) const override
| Return the local inertia tensor of the collision shape.
virtual std::string | to_string () const override
| Return the string representation of the shape.
Public Member Functions inherited from reactphysics3d::ConvexShape
| ConvexShape (CollisionShapeName name, CollisionShapeType type, MemoryAllocator &allocator, decimal margin=decimal(0.0))
| Constructor.
virtual | ~ConvexShape () override=default
| Destructor.
| ConvexShape (const ConvexShape &shape)=delete
| Deleted copy-constructor.
ConvexShape & | operator= (const ConvexShape &shape)=delete
| Deleted assignment operator.
decimal | getMargin () const
| Return the current object margin.
virtual bool | isConvex () const override
| Return true if the collision shape is convex, false if it is concave.
Public Member Functions inherited from reactphysics3d::CollisionShape
| 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 class represents a capsule collision shape that is defined around the Y axis.

A capsule shape can be seen as the convex hull of two spheres. The capsule shape is defined by its radius (radius of the two spheres of the capsule) and its height (distance between the centers of the two spheres). This collision shape does not have an explicit object margin distance. The margin is implicitly the radius and height of the shape. Therefore, no need to specify an object margin for a capsule shape.

## Member Function Documentation

## ◆ getHeight()

RP3D_FORCE_INLINE decimal reactphysics3d::CapsuleShape::getHeight | ( |  | ) | const

Return the height of the capsule.

Returns
  The height of the capsule shape (in meters)

## ◆ getLocalBounds()

AABB CapsuleShape::getLocalBounds | ( |  | ) | const
| overridevirtual

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

Returns
  The AABB of the shape

Implements reactphysics3d::CollisionShape.

## ◆ getLocalInertiaTensor()

Vector3 CapsuleShape::getLocalInertiaTensor | ( | decimal | mass | ) | const
| overridevirtual

Return the local inertia tensor of the collision shape.

Parameters

  mass | Mass to use to compute the inertia tensor of the collision shape

Implements reactphysics3d::CollisionShape.

## ◆ getRadius()

RP3D_FORCE_INLINE decimal reactphysics3d::CapsuleShape::getRadius | ( |  | ) | const

Return the radius of the capsule.

Returns
  The radius of the capsule shape (in meters)

## ◆ getVolume()

RP3D_FORCE_INLINE decimal reactphysics3d::CapsuleShape::getVolume | ( |  | ) | const
| overridevirtual

Compute and return the volume of the collision shape.

Implements reactphysics3d::CollisionShape.

## ◆ isPolyhedron()

RP3D_FORCE_INLINE bool reactphysics3d::CapsuleShape::isPolyhedron | ( |  | ) | const
| overridevirtual

Return true if the collision shape is a polyhedron.

Implements reactphysics3d::CollisionShape.

## ◆ setHeight()

RP3D_FORCE_INLINE void reactphysics3d::CapsuleShape::setHeight | ( | decimal | height | ) |

Set the height of the capsule.

Note that you might want to recompute the inertia tensor and center of mass of the body after changing the height of the collision shape.

Parameters

  height | The height of the capsule (in meters)

## ◆ setRadius()

RP3D_FORCE_INLINE void reactphysics3d::CapsuleShape::setRadius | ( | decimal | radius | ) |

Set the radius of the capsule.

Note that you might want to recompute the inertia tensor and center of mass of the body after changing the radius of the collision shape.

Parameters

  radius | The radius of the capsule (in meters)

## ◆ to_string()

RP3D_FORCE_INLINE std::string reactphysics3d::CapsuleShape::to_string | ( |  | ) | const
| overridevirtual

Return the string representation of the shape.

Implements reactphysics3d::CollisionShape.

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

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