![]() |
ReactPhysics3D
v0.10.2
C++ Physics engine library
|
A collider has a collision shape (box, sphere, capsule, ...) and is attached to a RigidBody. More...
#include <include/reactphysics3d/collision/Collider.h>
Public Member Functions | |
| Collider (Entity entity, Body *body, MemoryManager &memoryManager) | |
| Constructor. | |
| virtual | ~Collider () |
| Destructor. | |
| Collider (const Collider &collider)=delete | |
| Deleted copy-constructor. | |
| Collider & | operator= (const Collider &collider)=delete |
| Deleted assignment operator. | |
| Entity | getEntity () const |
| Return the corresponding entity of the collider. | |
| CollisionShape * | getCollisionShape () |
| Return a pointer to the collision shape. | |
| const CollisionShape * | getCollisionShape () const |
| Return a const pointer to the collision shape. | |
| Body * | getBody () const |
| Return the parent body. | |
| void * | getUserData () const |
| Return a pointer to the user data attached to this body. | |
| void | setUserData (void *userData) |
| Attach user data to this body. | |
| const Transform & | getLocalToBodyTransform () const |
| Return the local to parent body transform. | |
| void | setLocalToBodyTransform (const Transform &transform) |
| Set the local to parent body transform. | |
| const Transform | getLocalToWorldTransform () const |
| Return the local to world transform. | |
| const AABB | getWorldAABB () const |
| Return the AABB of the collider in world-space. | |
| bool | testAABBOverlap (const AABB &worldAABB) const |
| Test if the collider overlaps with a given AABB. | |
| bool | testPointInside (const Vector3 &worldPoint) |
| Return true if a point is inside the collision shape. | |
| bool | raycast (const Ray &ray, RaycastInfo &raycastInfo) |
| Raycast method with feedback information. | |
| unsigned short | getCollideWithMaskBits () const |
| Return the collision bits mask. | |
| void | setCollideWithMaskBits (unsigned short collideWithMaskBits) |
| Set the collision bits mask. | |
| unsigned short | getCollisionCategoryBits () const |
| Return the collision category bits. | |
| void | setCollisionCategoryBits (unsigned short collisionCategoryBits) |
| Set the collision category bits. | |
| int | getBroadPhaseId () const |
| Return the broad-phase id. | |
| Material & | getMaterial () |
| Return a reference to the material properties of the collider. | |
| void | setMaterial (const Material &material) |
| Set a new material for this collider. | |
| bool | getIsTrigger () const |
| Return true if the collider is a trigger. | |
| void | setIsTrigger (bool isTrigger) const |
| Set whether the collider is a trigger. | |
| bool | getIsSimulationCollider () const |
| Return true if the collider can generate contacts for the simulation of the associated body. | |
| void | setIsSimulationCollider (bool isSimulationCollider) const |
| Set whether the collider can generate contacts for the simulation of the associated body. | |
| bool | getIsWorldQueryCollider () const |
| Return true if the collider will be part of results of queries on the PhysicsWorld. | |
| void | setIsWorldQueryCollider (bool isWorldQueryCollider) const |
| Set whether the collider will be part of results of queries on the PhysicsWorld. | |
A collider has a collision shape (box, sphere, capsule, ...) and is attached to a RigidBody.
A body can have multiple colliders. The collider also have a mass value and a Material with many physics parameters like friction or bounciness. When you create a body, you need to attach at least one collider to it if you want that body to be able to collide in the physics world.
| Collider::Collider | ( | Entity | entity, |
| Body * | body, | ||
| MemoryManager & | memoryManager ) |
Constructor.
| entity | Entity of the collider |
| body | Pointer to the body |
| memoryManager | Reference to the memory manager |
| RP3D_FORCE_INLINE Body * reactphysics3d::Collider::getBody | ( | ) | const |
Return the parent body.
| unsigned short Collider::getCollideWithMaskBits | ( | ) | const |
Return the collision bits mask.
| unsigned short Collider::getCollisionCategoryBits | ( | ) | const |
Return the collision category bits.
| CollisionShape * Collider::getCollisionShape | ( | ) |
Return a pointer to the collision shape.
| const CollisionShape * Collider::getCollisionShape | ( | ) | const |
Return a const pointer to the collision shape.
| RP3D_FORCE_INLINE Entity reactphysics3d::Collider::getEntity | ( | ) | const |
Return the corresponding entity of the collider.
| bool Collider::getIsTrigger | ( | ) | const |
Return true if the collider is a trigger.
| const Transform & Collider::getLocalToBodyTransform | ( | ) | const |
Return the local to parent body transform.
| const Transform Collider::getLocalToWorldTransform | ( | ) | const |
Return the local to world transform.
| Material & Collider::getMaterial | ( | ) |
Return a reference to the material properties of the collider.
| RP3D_FORCE_INLINE void * reactphysics3d::Collider::getUserData | ( | ) | const |
Return a pointer to the user data attached to this body.
| const AABB Collider::getWorldAABB | ( | ) | const |
| bool Collider::raycast | ( | const Ray & | ray, |
| RaycastInfo & | raycastInfo ) |
Raycast method with feedback information.
| ray | Ray to use for the raycasting in world-space | |
| [out] | raycastInfo | Result of the raycasting that is valid only if the methods returned true |
| void Collider::setCollideWithMaskBits | ( | unsigned short | collideWithMaskBits | ) |
Set the collision bits mask.
| collideWithMaskBits | The bits mask that specifies with which collision category this shape will collide |
| void Collider::setCollisionCategoryBits | ( | unsigned short | collisionCategoryBits | ) |
Set the collision category bits.
| collisionCategoryBits | The collision category bits mask of the collider |
| void Collider::setIsSimulationCollider | ( | bool | isSimulationCollider | ) | const |
Set whether the collider can generate contacts for the simulation of the associated body.
Note that a collider cannot be a simulation collider and a trigger at the same time.
If you set this to true, this collider will stop being a trigger.
| isSimulationCollider | True if this collider can generate contacts for the simulation of the associated body. |
| void Collider::setIsTrigger | ( | bool | isTrigger | ) | const |
Set whether the collider is a trigger.
Note that a collider cannot be a simulation collider and a trigger at the same time.
If you set this to true, this collider will stop being a simulation collider.
| isTrigger | True if you want to set this collider as a trigger and false otherwise |
| void Collider::setIsWorldQueryCollider | ( | bool | isWorldQueryCollider | ) | const |
Set whether the collider will be part of results of queries on the PhysicsWorld.
| isWorldQueryCollider | True if this collider will be part of results of queries on the PhysicsWorld |
| void Collider::setLocalToBodyTransform | ( | const Transform & | transform | ) |
Set the local to parent body transform.
| transform | The transform from local-space of the collider into the local-space of the body |
| void Collider::setMaterial | ( | const Material & | material | ) |
Set a new material for this collider.
| material | The material you want to set to the body |
| RP3D_FORCE_INLINE void reactphysics3d::Collider::setUserData | ( | void * | userData | ) |
Attach user data to this body.
| userData | Pointer to the user data you want to store within the collider |
| RP3D_FORCE_INLINE bool reactphysics3d::Collider::testAABBOverlap | ( | const AABB & | worldAABB | ) | const |
| bool Collider::testPointInside | ( | const Vector3 & | worldPoint | ) |
Return true if a point is inside the collision shape.
| worldPoint | Point to test in world-space coordinates |