PixelLightAPI
.
|
Abstract PL physics (rigid) body base class. More...
#include <Body.h>
Public Member Functions | |
virtual PLPHYSICS_API | ~Body () |
Destructor. | |
PLPHYSICS_API BodyImpl & | GetBodyImpl () const |
Returns a reference to the physics API specific body implementation. | |
PLPHYSICS_API bool | IsActive () const |
Returns whether the body is currently active or not. | |
PLPHYSICS_API void | SetActive (bool bActive=true) |
Sets whether the body is currently active or not. | |
PLPHYSICS_API float | GetCollisionVolume () const |
Returns the collision volume of the physics body. | |
PLPHYSICS_API float | GetMass () const |
Returns the mass of the physics body. | |
PLPHYSICS_API void | GetCenterOfMass (PLMath::Vector3 &vPosition) const |
Gets the relative center of the mass. | |
PLPHYSICS_API void | SetCenterOfMass (const PLMath::Vector3 &vPosition) |
Sets the relative center of the mass. | |
PLPHYSICS_API void | GetPosition (PLMath::Vector3 &vPosition) const |
Gets the body position. | |
PLPHYSICS_API void | SetPosition (const PLMath::Vector3 &vPosition) |
Sets the body position. | |
PLPHYSICS_API void | GetRotation (PLMath::Quaternion &qRotation) const |
Gets the body rotation. | |
PLPHYSICS_API void | SetRotation (const PLMath::Quaternion &qRotation) |
Sets the body rotation. | |
PLPHYSICS_API void | GetTransformMatrix (PLMath::Matrix3x4 &mTrans) const |
Gets the body transform matrix. | |
PLPHYSICS_API void | SetTransformMatrix (const PLMath::Matrix3x4 &mTrans) |
Sets the body transform matrix. | |
PLPHYSICS_API void | GetAABoundingBox (PLMath::AABoundingBox &cAABoundingBox) const |
Gets the global space axis aligned bounding box of the body. | |
PLPHYSICS_API void | GetLinearVelocity (PLMath::Vector3 &vVelocity) const |
Gets the linear body velocity. | |
PLPHYSICS_API void | SetLinearVelocity (const PLMath::Vector3 &vVelocity) |
Sets the linear body velocity. | |
PLPHYSICS_API void | GetAngularVelocity (PLMath::Vector3 &vVelocity) const |
Gets the angular body velocity. | |
PLPHYSICS_API void | SetAngularVelocity (const PLMath::Vector3 &vVelocity) |
Sets the angular body velocity. | |
PLPHYSICS_API void | GetForce (PLMath::Vector3 &vForce) const |
Gets the force applied to the body at the next simulation update. | |
PLPHYSICS_API void | AddForce (const PLMath::Vector3 &vForce) |
Adds a force to the body. | |
PLPHYSICS_API void | SetForce (const PLMath::Vector3 &vForce) |
Sets the force applied to the body at the next simulation update. | |
PLPHYSICS_API void | GetTorque (PLMath::Vector3 &vTorque) const |
Gets the torque applied to the body at the next simulation update. | |
PLPHYSICS_API void | AddTorque (const PLMath::Vector3 &vTorque) |
Adds a torque to the body. | |
PLPHYSICS_API void | SetTorque (const PLMath::Vector3 &vTorque) |
Sets the torque applied to the body at the next simulation update. | |
PLPHYSICS_API bool | IsAutoFreeze () const |
Returns whether the body is frozen automatically or not. | |
PLPHYSICS_API void | SetAutoFreeze (bool bAutoFreeze=true) |
Sets whether the body is frozen automatically or not. | |
PLPHYSICS_API void | GetFreezeThreshold (float &fLinearVelocity, float &fAngularVelocity, PLCore::uint32 &nSteps) const |
Returns the freeze threshold. | |
PLPHYSICS_API void | SetFreezeThreshold (float fLinearVelocity=0.01f, float fAngularVelocity=0.01f, PLCore::uint32 nSteps=10) |
Sets the freeze threshold. | |
PLPHYSICS_API bool | IsFrozen () const |
Returns whether the body is currently frozen or not. | |
PLPHYSICS_API void | SetFrozen (bool bFrozen=true) |
Sets whether the body is currently frozen or not. | |
PLPHYSICS_API bool | IsCollisionActive () const |
Returns whether the body can collide or not. | |
PLPHYSICS_API void | SetCollisionActive (bool bActive=true) |
Sets whether the body can collide or not. | |
PLPHYSICS_API bool | GetUseGravity () const |
Returns whether the body ignores the gravity or not. | |
PLPHYSICS_API void | SetUseGravity (bool bUseGravity=true) |
Sets whether the body ignores the gravity or not. | |
PLPHYSICS_API PLCore::uint8 | GetCollisionGroup () const |
Returns the collision group the body is in. | |
PLPHYSICS_API void | SetCollisionGroup (PLCore::uint8 nCollisionGroup=0) |
Sets the collision group the body is in. | |
PLPHYSICS_API PLCore::uint32 | GetNumOfPartners () const |
Returns the number of partner bodies. | |
PLPHYSICS_API Body * | GetPartner (PLCore::uint32 nIndex) const |
Returns a partner body. | |
virtual PLPHYSICS_API void | SetMass (float fMass=0.0f) |
Sets the mass of the physics body. | |
virtual PLPHYSICS_API bool | IsBody () const override |
Returns whether or not this is a body. | |
virtual PLPHYSICS_API bool | IsJoint () const override |
Returns whether or not this is a joint. | |
virtual PLPHYSICS_API bool | IsSensor () const override |
Returns whether or not this is a sensor. | |
Public Attributes | |
PLCore::Event | EventTransform |
Protected Member Functions | |
PLPHYSICS_API | Body (World &cWorld, BodyImpl &cBodyImpl) |
Constructor. |
Abstract PL physics (rigid) body base class.
virtual PLPHYSICS_API PLPhysics::Body::~Body | ( | ) | [virtual] |
Destructor.
PLPHYSICS_API PLPhysics::Body::Body | ( | World & | cWorld, |
BodyImpl & | cBodyImpl | ||
) | [protected] |
Constructor.
[in] | cWorld | World this body is in |
[in] | cBodyImpl | Reference to the physics API specific body implementation |
PLPHYSICS_API BodyImpl& PLPhysics::Body::GetBodyImpl | ( | ) | const |
Returns a reference to the physics API specific body implementation.
PLPHYSICS_API bool PLPhysics::Body::IsActive | ( | ) | const |
Returns whether the body is currently active or not.
PLPHYSICS_API void PLPhysics::Body::SetActive | ( | bool | bActive = true | ) |
Sets whether the body is currently active or not.
[in] | bActive | 'true' if the body is currently active, else 'false' |
PLPHYSICS_API float PLPhysics::Body::GetCollisionVolume | ( | ) | const |
Returns the collision volume of the physics body.
PLPHYSICS_API float PLPhysics::Body::GetMass | ( | ) | const |
Returns the mass of the physics body.
PLPHYSICS_API void PLPhysics::Body::GetCenterOfMass | ( | PLMath::Vector3 & | vPosition | ) | const |
Gets the relative center of the mass.
[out] | vPosition | Will receive the relative center of the mass |
PLPHYSICS_API void PLPhysics::Body::SetCenterOfMass | ( | const PLMath::Vector3 & | vPosition | ) |
Sets the relative center of the mass.
[in] | vPosition | New relative center of the mass (PLMath::Vector3::Zero by default) |
PLPHYSICS_API void PLPhysics::Body::GetPosition | ( | PLMath::Vector3 & | vPosition | ) | const |
Gets the body position.
[out] | vPosition | Will receive the current body position |
PLPHYSICS_API void PLPhysics::Body::SetPosition | ( | const PLMath::Vector3 & | vPosition | ) |
Sets the body position.
[in] | vPosition | New body position |
PLPHYSICS_API void PLPhysics::Body::GetRotation | ( | PLMath::Quaternion & | qRotation | ) | const |
Gets the body rotation.
[out] | qRotation | Will receive the body rotation |
PLPHYSICS_API void PLPhysics::Body::SetRotation | ( | const PLMath::Quaternion & | qRotation | ) |
Sets the body rotation.
[in] | qRotation | New body rotation |
PLPHYSICS_API void PLPhysics::Body::GetTransformMatrix | ( | PLMath::Matrix3x4 & | mTrans | ) | const |
Gets the body transform matrix.
[out] | mTrans | Will receive the body transform matrix |
PLPHYSICS_API void PLPhysics::Body::SetTransformMatrix | ( | const PLMath::Matrix3x4 & | mTrans | ) |
Sets the body transform matrix.
[in] | mTrans | New body transform matrix |
PLPHYSICS_API void PLPhysics::Body::GetAABoundingBox | ( | PLMath::AABoundingBox & | cAABoundingBox | ) | const |
Gets the global space axis aligned bounding box of the body.
[out] | cAABoundingBox | Will receive the global space axis aligned bounding box of the body |
PLPHYSICS_API void PLPhysics::Body::GetLinearVelocity | ( | PLMath::Vector3 & | vVelocity | ) | const |
Gets the linear body velocity.
[out] | vVelocity | Will receive the current linear body velocity |
PLPHYSICS_API void PLPhysics::Body::SetLinearVelocity | ( | const PLMath::Vector3 & | vVelocity | ) |
Sets the linear body velocity.
[in] | vVelocity | New linear body velocity |
PLPHYSICS_API void PLPhysics::Body::GetAngularVelocity | ( | PLMath::Vector3 & | vVelocity | ) | const |
Gets the angular body velocity.
[out] | vVelocity | Will receive the current angular body velocity |
PLPHYSICS_API void PLPhysics::Body::SetAngularVelocity | ( | const PLMath::Vector3 & | vVelocity | ) |
Sets the angular body velocity.
[in] | vVelocity | New angular body velocity |
PLPHYSICS_API void PLPhysics::Body::GetForce | ( | PLMath::Vector3 & | vForce | ) | const |
Gets the force applied to the body at the next simulation update.
[out] | vForce | Will receive the force applied to the body at the next simulation update |
PLPHYSICS_API void PLPhysics::Body::AddForce | ( | const PLMath::Vector3 & | vForce | ) |
Adds a force to the body.
[in] | vForce | Force to add |
PLPHYSICS_API void PLPhysics::Body::SetForce | ( | const PLMath::Vector3 & | vForce | ) |
Sets the force applied to the body at the next simulation update.
[in] | vForce | Force to set |
PLPHYSICS_API void PLPhysics::Body::GetTorque | ( | PLMath::Vector3 & | vTorque | ) | const |
Gets the torque applied to the body at the next simulation update.
[out] | vTorque | Will receive the torque applied to the body at the next simulation update |
PLPHYSICS_API void PLPhysics::Body::AddTorque | ( | const PLMath::Vector3 & | vTorque | ) |
Adds a torque to the body.
[in] | vTorque | Torque to add |
PLPHYSICS_API void PLPhysics::Body::SetTorque | ( | const PLMath::Vector3 & | vTorque | ) |
Sets the torque applied to the body at the next simulation update.
[in] | vTorque | Torque to set |
PLPHYSICS_API bool PLPhysics::Body::IsAutoFreeze | ( | ) | const |
Returns whether the body is frozen automatically or not.
PLPHYSICS_API void PLPhysics::Body::SetAutoFreeze | ( | bool | bAutoFreeze = true | ) |
Sets whether the body is frozen automatically or not.
[in] | bAutoFreeze | 'true' if the body is frozen automatically, else 'false' |
PLPHYSICS_API void PLPhysics::Body::GetFreezeThreshold | ( | float & | fLinearVelocity, |
float & | fAngularVelocity, | ||
PLCore::uint32 & | nSteps | ||
) | const |
Returns the freeze threshold.
[out] | fLinearVelocity | Receives the linear velocity threshold |
[out] | fAngularVelocity | Receives the angular velocity threshold |
[out] | nSteps | Receives the number of steps the linear and angular velocity must be below the thresholds before the body is frozen |
PLPHYSICS_API void PLPhysics::Body::SetFreezeThreshold | ( | float | fLinearVelocity = 0.01f , |
float | fAngularVelocity = 0.01f , |
||
PLCore::uint32 | nSteps = 10 |
||
) |
Sets the freeze threshold.
[in] | fLinearVelocity | Linear velocity threshold |
[in] | fAngularVelocity | Angular velocity threshold |
[in] | nSteps | Number of steps the linear and angular velocity must be below the thresholds before the body is frozen |
PLPHYSICS_API bool PLPhysics::Body::IsFrozen | ( | ) | const |
Returns whether the body is currently frozen or not.
PLPHYSICS_API void PLPhysics::Body::SetFrozen | ( | bool | bFrozen = true | ) |
Sets whether the body is currently frozen or not.
[in] | bFrozen | 'true' if the body is currently frozen, else 'false' |
PLPHYSICS_API bool PLPhysics::Body::IsCollisionActive | ( | ) | const |
Returns whether the body can collide or not.
PLPHYSICS_API void PLPhysics::Body::SetCollisionActive | ( | bool | bActive = true | ) |
Sets whether the body can collide or not.
[in] | bActive | 'true' if the body can collide, else 'false' |
PLPHYSICS_API bool PLPhysics::Body::GetUseGravity | ( | ) | const |
Returns whether the body ignores the gravity or not.
PLPHYSICS_API void PLPhysics::Body::SetUseGravity | ( | bool | bUseGravity = true | ) |
Sets whether the body ignores the gravity or not.
[in] | bUseGravity | 'false' if the body ignores the gravity, else 'true' |
PLPHYSICS_API PLCore::uint8 PLPhysics::Body::GetCollisionGroup | ( | ) | const |
Returns the collision group the body is in.
PLPHYSICS_API void PLPhysics::Body::SetCollisionGroup | ( | PLCore::uint8 | nCollisionGroup = 0 | ) |
Sets the collision group the body is in.
[in] | nCollisionGroup | The collision group the body is in (0-31) |
PLPHYSICS_API PLCore::uint32 PLPhysics::Body::GetNumOfPartners | ( | ) | const |
Returns the number of partner bodies.
PLPHYSICS_API Body* PLPhysics::Body::GetPartner | ( | PLCore::uint32 | nIndex | ) | const |
Returns a partner body.
[in] | nIndex | Index of the partner body to return |
virtual PLPHYSICS_API void PLPhysics::Body::SetMass | ( | float | fMass = 0.0f | ) | [virtual] |
Sets the mass of the physics body.
[in] | fMass | New mass of the physics body, 0 = static body |
virtual PLPHYSICS_API bool PLPhysics::Body::IsBody | ( | ) | const [override, virtual] |
Returns whether or not this is a body.
Implements PLPhysics::Element.
virtual PLPHYSICS_API bool PLPhysics::Body::IsJoint | ( | ) | const [override, virtual] |
Returns whether or not this is a joint.
Implements PLPhysics::Element.
virtual PLPHYSICS_API bool PLPhysics::Body::IsSensor | ( | ) | const [override, virtual] |
Returns whether or not this is a sensor.
Implements PLPhysics::Element.
Transform was changed by the physics
|