![]() |
Quark Physics
1.0
2D Rigid and Soft Body Physics Engine
|
QAreaBody objects are objects that don't respond to collisions or receive any response from them, but only report collisions. An operation is not applied for them to move during physics steps, they are stationary. Unlike other body types, they have two event listeners named OnCollisionEnter and OnCollisionExit. More...
#include <qareabody.h>
Public Attributes | |
std::function< void(QAreaBody *areaBody, QBody *collidedBody)> | CollisionEnterEventListener |
std::function< void(QAreaBody *areaBody, QBody *collidedBody)> | CollisionExitEventListener |
std::function< QVector(QBody *body)> | ComputeLinearForceListener |
![]() | |
std::function< void(QBody *body)> | PreStepEventListener |
std::function< void(QBody *body)> | StepEventListener |
std::function< bool(QBody *body, CollisionInfo)> | CollisionEventListener |
bool | manualDeletion =false |
Friends | |
class | QManifold |
class | QWorld |
Additional Inherited Members | |
![]() | |
enum | Modes { DYNAMIC , STATIC } |
enum | BodyTypes { RIGID , AREA , SOFT } |
enum | SimulationModels { MASS_SPRING , RIGID_BODY } |
![]() | |
void | UpdateAABB () |
void | UpdateMeshTransforms () |
virtual void | Update () |
virtual void | PostUpdate () |
virtual bool | CanGiveCollisionResponseTo (QBody *otherBody) |
![]() | |
static QVector | ComputeFriction (QBody *bodyA, QBody *bodyB, QVector &normal, float penetration, QVector &relativeVelocity) |
static bool | CanCollide (QBody *bodyA, QBody *bodyB, bool checkBodiesAreEnabled=true) |
![]() | |
QWorld * | world |
QVector | position =QVector(0,0) |
QVector | prevPosition =QVector::Zero() |
float | rotation =0.0f |
float | prevRotation =0.0f |
QAABB | aabb |
Modes | mode =QBody::Modes::DYNAMIC |
bool | inertiaNeedsUpdate =true |
bool | circumferenceNeedsUpdate =true |
bool | enableBodySpecificTimeScale =false |
float | bodySpecificTimeScale =1.0f |
BodyTypes | bodyType =BodyTypes::RIGID |
bool | enabled =true |
float | velocityLimit =0.0f |
bool | enableIntegratedVelocities =true |
bool | enableCustomGravity =false |
QVector | customGravity =QVector::Zero() |
float | friction =0.2f |
float | staticFriction =0.5f |
float | airFriction =0.01f |
float | mass =1.0f |
float | restitution =0.0f |
int | layersBit =1 |
int | collidableLayersBit =1 |
bool | isKinematic =false |
bool | allowKinematicCollisions =false |
bool | isSleeping =false |
int | sleepTick =120 |
int | fixedVelocityTick =0 |
int | fixedAngularTick =0 |
bool | canSleep =true |
vector< QMesh * > | _meshes =vector<QMesh*>() |
SimulationModels | simulationModel =SimulationModels::RIGID_BODY |
bool | ignoreGravity =false |
QAreaBody objects are objects that don't respond to collisions or receive any response from them, but only report collisions. An operation is not applied for them to move during physics steps, they are stationary. Unlike other body types, they have two event listeners named OnCollisionEnter and OnCollisionExit.
A virtual function that enables the calculation of the linearForceToApply value specifically for each body object. If not overridden, it applies the linearForceToApply value defined for QAreaBody as a force to all objects. Additionally, if ComputeLinearForceListener is defined and not overridden, it applies the value returned by that listener.
|
inline |
Returns a collection of all QBodyNode objects currently within the area.
|
inline |
Returns whether the option to exempt objects entering the area from gravity is enabled. If enabled, it will disable both the globally defined gravity and the body-specific gravity applied to physics bodies entering the area.
|
inline |
Returns the amount of linear force to be applied to objects entering the area. If a force vector is defined, objects entering the area will be continuously subjected to this force.
|
inline |
Returns whether a given body is currently in contact with this QAreaBody.
|
inlinevirtual |
This event listener is triggered when any object enters the collision list of a QAreaBody for the first time.
collidedBody | The body entered to the collision list. |
|
inlinevirtual |
This event listener is triggered when any object exits the collision list of a QAreaBody for the first time.
collidedBody | The body exited from the collision list. |
|
inline |
Sets whether the option to exempt objects entering the area from gravity is enabled. If enabled, it will disable both the globally defined gravity and the body-specific gravity applied to physics bodies entering the area.
value | A bool vector to set |
Sets the amount of linear force to be applied to objects entering the area. If a force vector is defined, objects entering the area will be continuously subjected to this force.
value | A force vector to set. |
This is the event listener callback function for the OnCollisionEnter event.
areaBody | An area body. |
collidedBody | The collided body. |
This is the event listener callback function for the OnCollisionExit event.
areaBody | An area body. |
collidedBody | The collided body. |
Listener responsible for calculating the LinearForce value to be applied specifically to each body object. If this listener function is defined, it will be used as the return value of the QAreaBody::ComputeLinearForce() virtual function.
body | The body object within the area. |