ReactPhysics3D
v0.10.2
C++ Physics engine library
|
This class represent the component of the ECS that contains data about a rigid body. More...
#include <include/reactphysics3d/components/RigidBodyComponents.h>
Classes | |
struct | RigidBodyComponent |
Structure for the data of a rigid body component. More... | |
Public Member Functions | |
RigidBodyComponents (MemoryAllocator &allocator) | |
Constructor. | |
virtual | ~RigidBodyComponents () override=default |
Destructor. | |
void | addComponent (Entity bodyEntity, bool isDisabled, const RigidBodyComponent &component) |
Add a component. | |
RigidBody * | getRigidBody (Entity bodyEntity) |
Return a pointer to a rigid body. | |
bool | getIsAllowedToSleep (Entity bodyEntity) const |
Return true if the body is allowed to sleep. | |
void | setIsAllowedToSleep (Entity bodyEntity, bool isAllowedToSleep) const |
Set the value to know if the body is allowed to sleep. | |
bool | getIsSleeping (Entity bodyEntity) const |
Return true if the body is sleeping. | |
void | setIsSleeping (Entity bodyEntity, bool isSleeping) const |
Set the value to know if the body is sleeping. | |
decimal | getSleepTime (Entity bodyEntity) const |
Return the sleep time. | |
void | setSleepTime (Entity bodyEntity, decimal sleepTime) const |
Set the sleep time. | |
BodyType | getBodyType (Entity bodyEntity) |
Return the body type of a body. | |
void | setBodyType (Entity bodyEntity, BodyType bodyType) |
Set the body type of a body. | |
const Vector3 & | getLinearVelocity (Entity bodyEntity) const |
Return the linear velocity of an entity. | |
void | setLinearVelocity (Entity bodyEntity, const Vector3 &linearVelocity) |
Set the linear velocity of an entity. | |
const Vector3 & | getAngularVelocity (Entity bodyEntity) const |
Return the angular velocity of an entity. | |
void | setAngularVelocity (Entity bodyEntity, const Vector3 &angularVelocity) |
Set the angular velocity of an entity. | |
const Vector3 & | getExternalForce (Entity bodyEntity) const |
Return the external force of an entity. | |
const Vector3 & | getExternalTorque (Entity bodyEntity) const |
Return the external torque of an entity. | |
decimal | getLinearDamping (Entity bodyEntity) const |
Return the linear damping factor of an entity. | |
decimal | getAngularDamping (Entity bodyEntity) const |
Return the angular damping factor of an entity. | |
decimal | getMass (Entity bodyEntity) const |
Return the mass of an entity. | |
void | setMass (Entity bodyEntity, decimal mass) |
Set the mass of an entity. | |
decimal | getMassInverse (Entity bodyEntity) const |
Return the mass inverse of an entity. | |
void | setMassInverse (Entity bodyEntity, decimal inverseMass) |
Set the inverse mass of an entity. | |
const Vector3 & | getLocalInertiaTensor (Entity bodyEntity) |
Return the local inertia tensor of an entity. | |
void | setLocalInertiaTensor (Entity bodyEntity, const Vector3 &inertiaTensorLocal) |
Set the local inertia tensor of an entity. | |
const Vector3 & | getInertiaTensorLocalInverse (Entity bodyEntity) |
Return the inverse local inertia tensor of an entity. | |
const Matrix3x3 & | getInertiaTensorWorldInverse (Entity bodyEntity) |
Return the inverse world inertia tensor of an entity. | |
void | setInertiaTensorWorldInverse (Entity bodyEntity, const Matrix3x3 &inertiaTensor) |
Set the inverse world inertia tensor of an entity. | |
void | setExternalForce (Entity bodyEntity, const Vector3 &externalForce) |
Set the external force of an entity. | |
void | setExternalTorque (Entity bodyEntity, const Vector3 &externalTorque) |
Set the external force of an entity. | |
void | setLinearDamping (Entity bodyEntity, decimal linearDamping) |
Set the linear damping factor of an entity. | |
void | setAngularDamping (Entity bodyEntity, decimal angularDamping) |
Set the angular damping factor of an entity. | |
void | setInverseInertiaTensorLocal (Entity bodyEntity, const Vector3 &inertiaTensorLocalInverse) |
Set the inverse local inertia tensor of an entity. | |
const Vector3 & | getConstrainedLinearVelocity (Entity bodyEntity) const |
Return the constrained linear velocity of an entity. | |
const Vector3 & | getConstrainedAngularVelocity (Entity bodyEntity) const |
Return the constrained angular velocity of an entity. | |
const Vector3 & | getSplitLinearVelocity (Entity bodyEntity) const |
Return the split linear velocity of an entity. | |
const Vector3 & | getSplitAngularVelocity (Entity bodyEntity) const |
Return the split angular velocity of an entity. | |
Vector3 & | getConstrainedPosition (Entity bodyEntity) |
Return the constrained position of an entity. | |
Quaternion & | getConstrainedOrientation (Entity bodyEntity) |
Return the constrained orientation of an entity. | |
const Vector3 & | getCenterOfMassLocal (Entity bodyEntity) |
Return the local center of mass of an entity. | |
const Vector3 & | getCenterOfMassWorld (Entity bodyEntity) |
Return the world center of mass of an entity. | |
bool | getIsGravityEnabled (Entity bodyEntity) const |
Return true if gravity is enabled for this entity. | |
bool | getIsAlreadyInIsland (Entity bodyEntity) const |
Return true if the entity is already in an island. | |
const Vector3 & | getLinearLockAxisFactor (Entity bodyEntity) const |
Return the lock translation factor. | |
const Vector3 & | getAngularLockAxisFactor (Entity bodyEntity) const |
Return the lock rotation factor. | |
void | setConstrainedLinearVelocity (Entity bodyEntity, const Vector3 &constrainedLinearVelocity) |
Set the constrained linear velocity of an entity. | |
void | setConstrainedAngularVelocity (Entity bodyEntity, const Vector3 &constrainedAngularVelocity) |
Set the constrained angular velocity of an entity. | |
void | setSplitLinearVelocity (Entity bodyEntity, const Vector3 &splitLinearVelocity) |
Set the split linear velocity of an entity. | |
void | setSplitAngularVelocity (Entity bodyEntity, const Vector3 &splitAngularVelocity) |
Set the split angular velocity of an entity. | |
void | setConstrainedPosition (Entity bodyEntity, const Vector3 &constrainedPosition) |
Set the constrained position of an entity. | |
void | setConstrainedOrientation (Entity bodyEntity, const Quaternion &constrainedOrientation) |
Set the constrained orientation of an entity. | |
void | setCenterOfMassLocal (Entity bodyEntity, const Vector3 ¢erOfMassLocal) |
Set the local center of mass of an entity. | |
void | setCenterOfMassWorld (Entity bodyEntity, const Vector3 ¢erOfMassWorld) |
Set the world center of mass of an entity. | |
void | setIsGravityEnabled (Entity bodyEntity, bool isGravityEnabled) |
Set the value to know if the gravity is enabled for this entity. | |
void | setIsAlreadyInIsland (Entity bodyEntity, bool isAlreadyInIsland) |
Set the value to know if the entity is already in an island. | |
void | setLinearLockAxisFactor (Entity bodyEntity, const Vector3 &linearLockAxisFactor) |
Set the linear lock axis factor. | |
void | setAngularLockAxisFactor (Entity bodyEntity, const Vector3 &rotationTranslationFactor) |
Set the angular lock axis factor. | |
const Array< Entity > & | getJoints (Entity bodyEntity) const |
Return the array of joints of a body. | |
void | addJointToBody (Entity bodyEntity, Entity jointEntity) |
Add a joint to a body component. | |
void | removeJointFromBody (Entity bodyEntity, Entity jointEntity) |
Remove a joint from a body component. | |
void | addContacPair (Entity bodyEntity, uint32 contactPairIndex) |
A an associated contact pairs into the contact pairs array of the body. | |
void | removeAllContacPairs (Entity bodyEntity) |
Remove all the contact pairs of a body. | |
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. | |
This class represent the component of the ECS that contains data about a rigid body.
The components of the sleeping entities (bodies) are always stored at the end of the array.