A QWorld object is required to create a physics simulation. The QWorld class manages the entire physics simulation. You can add or remove objects to the physics world and make specific settings for the simulation. Additionally, the QWorld class is responsible for updating the simulation.
More...
#include <qworld.h>
|
QVector | GetGravity () |
|
bool | GetSleepingEnabled () |
|
float | GetSleepingPositionTolerance () |
|
float | GetSleepingRotationTolerance () |
|
bool | GetBroadphaseEnabled () |
|
QBroadPhase * | GetBroadphase () |
|
int | GetIterationCount () |
|
float | GetTimeScale () |
|
bool | GetEnabled () |
|
QWorld * | SetGravity (QVector value) |
|
QWorld * | SetSleepingEnabled (bool value) |
|
QWorld * | SetSleepingPositionTolerance (float value) |
|
QWorld * | SetSleepingRotationTolerance (float value) |
|
QWorld * | SetBroadphaseEnabled (bool value) |
|
QWorld * | SetBroadphase (QBroadPhase *externalBroadphase) |
|
QWorld * | SetIterationCount (int value) |
|
QWorld * | SetTimeScale (float value=1.0f) |
|
QWorld * | SetEnabled (bool value) |
|
void | Update () |
|
QWorld * | AddBody (QBody *body) |
|
QWorld * | AddBodyGroup (const vector< QBody * > &bodyGroup) |
|
QWorld * | RemoveBody (QBody *body) |
|
QWorld * | RemoveBodyAt (int index) |
|
int | GetBodyCount () |
|
QBody * | GetBodyAt (int index) |
|
int | GetBodyIndex (QBody *body) |
|
vector< QBody * > | GetBodiesHitByPoint (QVector point, int maxBodyCount=1, bool onlyRigidBodies=true, int layersBit=-1) |
|
vector< QParticle * > | GetParticlesCloseToPoint (QVector point, float distance, int maxParticleCount=1, bool exceptRigidBodies=true, int layersBit=-1) |
|
bool | CollideWithWorld (QBody *body) |
|
vector< QManifold > | TestCollisionWithWorld (QBody *body) |
|
QWorld * | AddJoint (QJoint *joint) |
|
QWorld * | RemoveJoint (QJoint *joint) |
|
QWorld * | RemoveJointAt (int index) |
|
QWorld * | RemoveMatchingJoints (QBody *body) |
|
int | GetJointCount () |
|
QJoint * | GetJointAt (int index) |
|
int | GetJointIndex (QJoint *joint) |
|
QWorld * | AddSpring (QSpring *spring) |
|
QWorld * | RemoveSpring (QSpring *spring) |
|
QWorld * | RemoveSpringAt (int index) |
|
QWorld * | RemoveMatchingSprings (QBody *body) |
|
QWorld * | RemoveMatchingSprings (QParticle *particle) |
|
int | GetSpringCount () |
|
QSpring * | GetSpringAt (int index) |
|
int | GetSpringIndex (QSpring *spring) |
|
QWorld * | AddRaycast (QRaycast *raycast) |
|
QWorld * | RemoveRaycast (QRaycast *raycast) |
|
QWorld * | RemoveRaycastAt (int index) |
|
int | GetRaycastCount () |
|
QRaycast * | GetRaycastAt (int index) |
|
int | GetRaycastIndex (QRaycast *raycast) |
|
vector< QGizmo * > * | GetGizmos () |
|
QWorld * | AddCollisionException (QBody *bodyA, QBody *bodyB) |
|
QWorld * | RemoveCollisionException (QBody *bodyA, QBody *bodyB) |
|
QWorld * | RemoveMatchingCollisionException (QBody *body) |
|
bool | CheckCollisionException (QBody *bodyA, QBody *bodyB) |
|
| QWorld () |
|
QWorld * | ClearJoints () |
|
QWorld * | ClearSprings () |
|
QWorld * | ClearRaycasts () |
|
QWorld * | ClearWorld () |
|
|
static float | MAX_WORLD_SIZE =99999.0f |
|
|
void | ClearGizmos () |
|
void | ClearBodies () |
|
void | CreateIslands (int bodyIndex, vector< QBody * > &bodyList, vector< QBody * > &island, vector< bool > &visitedList) |
|
void | GenerateIslands (vector< QBody * > &bodyList, vector< vector< QBody * >> &islandList) |
|
void | GetCollisionPairs (vector< QBody * > &bodyList, vector< pair< QBody *, QBody * > > *resList) |
|
void | CreateIslands (QBody &body, vector< QBody * > island) |
|
vector< vector< QBody > > | GenerateIslands (vector< QBody > bodyList) |
|
void | UpdateConstraints () |
|
|
static bool | SortBodiesHorizontal (const QBody *bodyA, const QBody *bodyB) |
|
static bool | SortBodiesVertical (const QBody *bodyA, const QBody *bodyB) |
|
|
class | QCollision |
|
class | QManifold |
|
class | QSoftBody |
|
class | QBroadPhase |
|
A QWorld object is required to create a physics simulation. The QWorld class manages the entire physics simulation. You can add or remove objects to the physics world and make specific settings for the simulation. Additionally, the QWorld class is responsible for updating the simulation.
◆ QWorld()
◆ AddBody()
Adds a body to the world
- Parameters
-
◆ AddBodyGroup()
QWorld * QWorld::AddBodyGroup |
( |
const vector< QBody * > & |
bodyGroup | ) |
|
Adds a body group to the world
- Parameters
-
bodyGroup | A collection of bodies to be added |
◆ AddCollisionException()
Adds a collision exception between two bodies. These bodies will never collide.
- Parameters
-
bodyA | A body in the world. |
bodyB | Another body in the world. |
◆ AddJoint()
Adds a joint to the world.
- Parameters
-
◆ AddRaycast()
Adds a raycast to the world.
- Parameters
-
raycast | A raycast to be added. |
◆ AddSpring()
Adds a spring to the world.
- Parameters
-
spring | A spring to be added. |
◆ CheckCollisionException()
bool QWorld::CheckCollisionException |
( |
QBody * |
bodyA, |
|
|
QBody * |
bodyB |
|
) |
| |
Checks whether there is a collision exception between two bodies.
- Parameters
-
bodyA | A body in the world. |
bodyB | Another body in the world. |
◆ ClearJoints()
QWorld * QWorld::ClearJoints |
( |
| ) |
|
Removes all joints from the world.
◆ ClearRaycasts()
QWorld * QWorld::ClearRaycasts |
( |
| ) |
|
It removes all raycasts from the world.
◆ ClearSprings()
QWorld * QWorld::ClearSprings |
( |
| ) |
|
Removes all springs from the world.
◆ ClearWorld()
QWorld * QWorld::ClearWorld |
( |
| ) |
|
It removes all objects from the world.
◆ CollideWithWorld()
bool QWorld::CollideWithWorld |
( |
QBody * |
body | ) |
|
Collides a body given to other bodies in the world. If is there a collision, it returns true.
- Parameters
-
body | A body from the world. |
◆ GetBodiesHitByPoint()
vector< QBody * > QWorld::GetBodiesHitByPoint |
( |
QVector |
point, |
|
|
int |
maxBodyCount = 1 , |
|
|
bool |
onlyRigidBodies = true , |
|
|
int |
layersBit = -1 |
|
) |
| |
Returns a list of bodies that collide with the point given.
- Parameters
-
point | A point to be collided. |
maxBodyCount | The maximum number of bodies to be returned. |
onlyRigidBodies | If set to true, it only tests rigid bodies.(It's true as a default) |
layersBit | Collision layer bits(It setted -1 as a default, it's mean it doesn't filter bodies via layer bits ) |
◆ GetBodyAt()
QBody* QWorld::GetBodyAt |
( |
int |
index | ) |
|
|
inline |
Returns body at the specified index
- Parameters
-
index | The Index of the body to get. |
◆ GetBodyCount()
int QWorld::GetBodyCount |
( |
| ) |
|
|
inline |
Returns the total body count in the world.
◆ GetBodyIndex()
int QWorld::GetBodyIndex |
( |
QBody * |
body | ) |
|
|
inline |
Returns index of the specified body
- Parameters
-
◆ GetBroadphase()
Returns the external broad phase object if defined. If not defined, returns nullptr.
◆ GetBroadphaseEnabled()
bool QWorld::GetBroadphaseEnabled |
( |
| ) |
|
|
inline |
Returns whether broad phase optimization will be applied to the collisions.
◆ GetCollisions()
Performs the collision of the body and returns a contact list as a collision result.
- Parameters
-
bodyA | A body in the world. |
bodyB | Another body in the world. |
◆ GetEnabled()
bool QWorld::GetEnabled |
( |
| ) |
|
|
inline |
Returns whether world is enabled.
◆ GetGizmos()
vector<QGizmo*>* QWorld::GetGizmos |
( |
| ) |
|
|
inline |
Returns the collection of gizmos in the world.
◆ GetIterationCount()
int QWorld::GetIterationCount |
( |
| ) |
|
|
inline |
Returns the iteration count per step of physics in the world. The Iteration count determines the stability level of the simulation.
◆ GetJointAt()
QJoint* QWorld::GetJointAt |
( |
int |
index | ) |
|
|
inline |
Returns the joint at the specified index.
- Parameters
-
index | The index of the joint. |
◆ GetJointCount()
int QWorld::GetJointCount |
( |
| ) |
|
|
inline |
Returns the total joint count of the world.
◆ GetJointIndex()
int QWorld::GetJointIndex |
( |
QJoint * |
joint | ) |
|
|
inline |
Returns the index of the specified joint.
- Parameters
-
joint | A joint in the world. |
◆ GetParticlesCloseToPoint()
vector< QParticle * > QWorld::GetParticlesCloseToPoint |
( |
QVector |
point, |
|
|
float |
distance, |
|
|
int |
maxParticleCount = 1 , |
|
|
bool |
exceptRigidBodies = true , |
|
|
int |
layersBit = -1 |
|
) |
| |
Returns nearest particles to the specified point.
- Parameters
-
point | A point to test |
distance | The distance of proximity to the point |
maxParticleCount | The maximum number of particles to be returned. |
exceptRigidBodies | If set to true, it tests only non-rigid bodies. |
layersBit | Collision layer bits(It setted -1 as a default, it's mean doesn't filter bodies via layer bits ) |
◆ GetRaycastAt()
QRaycast* QWorld::GetRaycastAt |
( |
int |
index | ) |
|
|
inline |
Returns the raycast at the specified index.
- Parameters
-
index | The index of the raycast |
◆ GetRaycastCount()
int QWorld::GetRaycastCount |
( |
| ) |
|
|
inline |
Returns the total raycast count of the world.
◆ GetRaycastIndex()
int QWorld::GetRaycastIndex |
( |
QRaycast * |
raycast | ) |
|
|
inline |
Returns the index of the specified raycast.
- Parameters
-
raycast | A raycast in the world. |
◆ GetSleepingEnabled()
bool QWorld::GetSleepingEnabled |
( |
| ) |
|
|
inline |
Returns whether sleep mode will be applied to dynamic objects.
◆ GetSleepingPositionTolerance()
float QWorld::GetSleepingPositionTolerance |
( |
| ) |
|
|
inline |
Returns the sleeping position tolerance. If the sleeping option is active, objects will go to sleep as long as they do not exceed this position change limit within a certain step amount.
◆ GetSleepingRotationTolerance()
float QWorld::GetSleepingRotationTolerance |
( |
| ) |
|
|
inline |
Returns the sleeping rotation tolerance. If the sleeping option is active, objects will go to sleep as long as they do not exceed this rotation change limit within a certain step amount.
◆ GetSpringAt()
QSpring* QWorld::GetSpringAt |
( |
int |
index | ) |
|
|
inline |
Returns the spring at the specified index.
- Parameters
-
index | The index of the spring. |
◆ GetSpringCount()
int QWorld::GetSpringCount |
( |
| ) |
|
|
inline |
Returns the total spring count of the world.
◆ GetSpringIndex()
int QWorld::GetSpringIndex |
( |
QSpring * |
spring | ) |
|
|
inline |
Returns the index of the specified spring.
- Parameters
-
spring | A spring in the world. |
◆ GetTimeScale()
float QWorld::GetTimeScale |
( |
| ) |
|
|
inline |
Returns the time scale for the physics simulation.
◆ RemoveBody()
Removes body from the world.
- Parameters
-
body | A body to be removed. |
◆ RemoveBodyAt()
QWorld * QWorld::RemoveBodyAt |
( |
int |
index | ) |
|
Removes the body from the world at the specified index. The index of a body can be obtained using the GetBodyIndex() method.
- Parameters
-
index | The index of the body to remove. |
◆ RemoveCollisionException()
Removes a collision exception.
- Parameters
-
bodyA | A body in the world. |
bodyB | Another body in the world. |
◆ RemoveJoint()
Removes a joint from the world.
- Parameters
-
joint | A joint to be removed. |
◆ RemoveJointAt()
QWorld * QWorld::RemoveJointAt |
( |
int |
index | ) |
|
Removes a joint from the world at the specified index. The index of a joint can be obtained using the GetJointIndex() method.
- Parameters
-
index | The index of the joint to be removed. |
◆ RemoveMatchingCollisionException()
QWorld * QWorld::RemoveMatchingCollisionException |
( |
QBody * |
body | ) |
|
Removes a collision exception that contains the given body.
- Parameters
-
body | A body to be matched. |
◆ RemoveMatchingJoints()
Removes the joints that contain the specified body.
- Parameters
-
body | A body to be matched. |
◆ RemoveMatchingSprings() [1/2]
Removes the springs that contain the specified body.
- Parameters
-
body | A body to be matched. |
◆ RemoveMatchingSprings() [2/2]
Removes the springs that contain the specified particle.
- Parameters
-
particle | A particle to be matched. |
◆ RemoveRaycast()
Removes a raycast from the world.
- Parameters
-
raycast | A raycast to be removed. |
◆ RemoveRaycastAt()
QWorld * QWorld::RemoveRaycastAt |
( |
int |
index | ) |
|
Removes a raycast from the world at the specified index. The index of a raycast can be obtained using the GetRaycastIndex() method.
- Parameters
-
◆ RemoveSpring()
Removes a spring from the world.
- Parameters
-
spring | A spring to be removed. |
◆ RemoveSpringAt()
QWorld * QWorld::RemoveSpringAt |
( |
int |
index | ) |
|
Removes a spring from the world at the specified index. The index of a spring can be obtained using the GetSpringIndex() method.
- Parameters
-
index | The index of the spring to be removed. |
◆ SetBroadphase()
Custom solutions inheriting from the QBroadphase class can be defined for the broad phase. This allows external broad phase solutions to be plugged in or removed.
- Parameters
-
externalBroadphase | A QBroadphase-typed class representing the external broad phase solution. |
◆ SetBroadphaseEnabled()
QWorld* QWorld::SetBroadphaseEnabled |
( |
bool |
value | ) |
|
|
inline |
Sets whether broad phase optimization will be applied to the collisions.
◆ SetEnabled()
QWorld* QWorld::SetEnabled |
( |
bool |
value | ) |
|
|
inline |
Sets whether world is enabled.
- Parameters
-
◆ SetGravity()
Sets the gravity force of the world. The gravity force applies to dynamic bodies in every step of physics.
- Parameters
-
value | The force vector value of the gravity. |
◆ SetIterationCount()
QWorld* QWorld::SetIterationCount |
( |
int |
value | ) |
|
|
inline |
Sets the iteration count per step of physics in the world. Iteration count determines stability level of the simulation.
- Parameters
-
value | The number of iterations per step. |
◆ SetSleepingEnabled()
QWorld* QWorld::SetSleepingEnabled |
( |
bool |
value | ) |
|
|
inline |
Sets whether sleep mode will be applied to dynamic objects.
- Parameters
-
◆ SetSleepingPositionTolerance()
QWorld* QWorld::SetSleepingPositionTolerance |
( |
float |
value | ) |
|
|
inline |
Sets the sleeping position tolerance. If the sleeping option is active, objects will go to sleep as long as they do not exceed this position change limit within a certain step amount.
- Parameters
-
◆ SetSleepingRotationTolerance()
QWorld* QWorld::SetSleepingRotationTolerance |
( |
float |
value | ) |
|
|
inline |
Sets the sleeping rotation tolerance. If the sleeping option is active, objects will go to sleep as long as they do not exceed this rotation change limit within a certain step amount.
- Parameters
-
◆ SetTimeScale()
QWorld* QWorld::SetTimeScale |
( |
float |
value = 1.0f | ) |
|
|
inline |
Sets the time scale for the physics simulation. The default value is 1.0. If you give a value lower than 1.0, the simulation will slow down, and if you give a value higher than 1.0, the simulation will speed up.
- Parameters
-
◆ TestCollisionWithWorld()
Applies a collision test between a body and other bodies in the world, returning a list of manifolds if collisions are detected.
- Parameters
-
body | A body from the world. |
◆ Update()
Updates the physics simulation of the world as a step.
The documentation for this class was generated from the following files:
- QuarkPhysics/qworld.h
- QuarkPhysics/qworld.cpp