ReactPhysics3D  v0.10.1
C++ Physics engine library
reactphysics3d::BodyComponents Class Reference

This class represent the component of the ECS that contains data about a body. More...

#include <include/reactphysics3d/components/BodyComponents.h>

Inheritance diagram for reactphysics3d::BodyComponents:
reactphysics3d::Components

Classes

struct  BodyComponent
 Structure for the data of a collision body component. More...
 

Public Member Functions

 BodyComponents (MemoryAllocator &allocator)
 Constructor.
 
virtual ~BodyComponents () override=default
 Destructor.
 
void addComponent (Entity bodyEntity, bool isDisabled, const BodyComponent &component)
 Add a component.
 
void addColliderToBody (Entity bodyEntity, Entity colliderEntity)
 Add a collider to a body component.
 
void removeColliderFromBody (Entity bodyEntity, Entity colliderEntity)
 Remove a collider from a body component.
 
BodygetBody (Entity bodyEntity)
 Return a pointer to a body.
 
const Array< Entity > & getColliders (Entity bodyEntity) const
 Return the array of colliders of a body.
 
bool getIsActive (Entity bodyEntity) const
 Return true if the body is active.
 
void setIsActive (Entity bodyEntity, bool isActive) const
 Set the value to know if the body is active.
 
void * getUserData (Entity bodyEntity) const
 Return the user data associated with the body.
 
void setUserData (Entity bodyEntity, void *userData) const
 Set the user data associated with the body.
 
bool getHasSimulationCollider (Entity bodyEntity) const
 Return true if the body has at least one simulation collider.
 
void setHasSimulationCollider (Entity bodyEntity, bool hasSimulationCollider) const
 Set whether the body has at least one simulation collider.
 
- Public Member Functions inherited from reactphysics3d::Components
 Components (MemoryAllocator &allocator, size_t componentDataSize, size_t alignmentMarginSize)
 Constructor.
 
virtual ~Components ()
 Destructor.
 
void init ()
 Initialize the components:
 
void removeComponent (Entity entity)
 Remove a component.
 
bool getIsEntityDisabled (Entity entity) const
 Return true if an entity is disabled.
 
void setIsEntityDisabled (Entity entity, bool isDisabled)
 Notify if a given entity is disabled.
 
bool hasComponent (Entity entity) const
 Return true if there is a component for a given entity.
 
bool hasComponentGetIndex (Entity entity, uint32 &entityIndex) const
 Return true if there is a component for a given entiy and if so set the entity index.
 
uint32 getNbComponents () const
 Return the number of components.
 
uint32 getNbEnabledComponents () const
 Return the number of enabled components.
 
uint32 getEntityIndex (Entity entity) const
 Return the index in the arrays for a given entity.
 

Detailed Description

This class represent the component of the ECS that contains data about a body.

The components of the sleeping entities (bodies) are always stored at the end of the array.


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