QParticle objects form the network structures of QMesh objects defined for all body object types. They are the smallest building blocks of physics simulation and are manipulated differently in different body object types. For example, in QRigidBody objects, particles are collectively forced into positions obtained through various calculations based on the current body properties. However, in soft body objects, simulation particles are individually manipulated and can move freely, determining the next steps of the simulation through their individual movements. QMesh objects offer a number of methods to manage particles. For more information on restrictions between particles in soft body objects, see the QSpring object.
More...
#include <qparticle.h>
|
void | ResetOneTimeCollisions () |
|
void | UpdateAABB () |
|
|
std::unordered_set< QParticle * > | springConnectedParticles |
|
unordered_set< QBody * > | oneTimeCollidedBodies |
|
unordered_set< QBody * > | previousCollidedBodies |
|
bool | ignoreGravity =false |
|
|
class | QMesh |
|
class | QBody |
|
class | QManifold |
|
class | QAreaBody |
|
class | QCollision |
|
QParticle objects form the network structures of QMesh objects defined for all body object types. They are the smallest building blocks of physics simulation and are manipulated differently in different body object types. For example, in QRigidBody objects, particles are collectively forced into positions obtained through various calculations based on the current body properties. However, in soft body objects, simulation particles are individually manipulated and can move freely, determining the next steps of the simulation through their individual movements. QMesh objects offer a number of methods to manage particles. For more information on restrictions between particles in soft body objects, see the QSpring object.
◆ AddAccumulatedForce()
Adds a new force to the accumulated forces. The purpose of the accumulated forces is to apply their arithmetic average using ApplyAccumulatedForce(). Before performing operations with the accumulated forces, they must be cleared using ClearAccumulatedForce().
- Parameters
-
- Returns
- A pointer to the particle itself.
◆ AddForce()
Adds a value to the force of the particle.Set forces determine the force to be applied to a particle object at the next physics step from the current step.
- Parameters
-
- Returns
- A pointer to the particle itself.
◆ AddGlobalPosition()
Adds a value to the global position of the particle.
- Parameters
-
value | A position value to set. |
- Returns
- A pointer to the particle itself.
◆ AddPosition()
Adds a value to the local position of the particle.
- Parameters
-
- Returns
- A pointer to the particle itself.
◆ AddPreviousGlobalPosition()
Adds a value to the previous global position of the particle.
- Parameters
-
- Returns
- A pointer to the particle itself.
◆ ApplyAccumulatedForces()
QParticle * QParticle::ApplyAccumulatedForces |
( |
| ) |
|
Calculates the arithmetic average of the accumulated forces based on the number of forces, applies it to the particle, and then clears all forces.
◆ ApplyForce()
Applies a force immediately to the particle. You can use the method safely before the physics step (e.g. at the OnPreStep event of QBody objects). If you want to use this method after physics step, it can break the simulation.(Collisions and constraints may not be applied properly.) if you want to apply force at the next physic step safely, use SetForce() and AddForce() methods.
- Parameters
-
value | A force value to apply. |
◆ ApplyForceToParticleSegment()
Applies a specified force to a segment created by two particles at a specific position.
- Parameters
-
pA | A particle in the world. |
pB | Another particle in the world. |
force | A force value to apply. |
fromPosition | The position of the force. |
◆ ClearAccumulatedForces()
QParticle * QParticle::ClearAccumulatedForces |
( |
| ) |
|
Clears the accumulated forces. It should be called before working with accumulated forces. Additionally, the accumulated forces are automatically cleared after the ApplyAccumulatedForce() method is called.
◆ GetAABB()
QAABB QParticle::GetAABB |
( |
| ) |
|
|
inline |
Returns the AABB of the particle.
◆ GetEnabled()
bool QParticle::GetEnabled |
( |
| ) |
|
|
inline |
Returns whether the particle is enabled. Disabled particles are not exempt from the collision tests that involve the meshes they belong to, but the solutions of their manifolds are not applied. Additionally, in body types where particles can move freely individually (e.g., QSoftBody), force and velocity integrations are not applied.
- Note
- Disabled particles in QRigidBody objects may appear to move because they are transformed based on the position and rotation of the rigid body.
◆ GetForce()
Returns the current force value of the particle.
◆ GetGlobalPosition()
QVector QParticle::GetGlobalPosition |
( |
| ) |
|
|
inline |
Returns the global position of the particle.
◆ GetIsInternal()
bool QParticle::GetIsInternal |
( |
| ) |
|
|
inline |
Returns whether the particle is internal. Internal particle definition is used not for the particles that define the collision boundaries of a mesh, but for the grid particles inside these boundaries. This feature is important for simulation types that require different internal particle simulation, such as volume preserved soft bodies.
◆ GetIsLazy()
bool QParticle::GetIsLazy |
( |
| ) |
|
|
inline |
Returns whether the particle's lazy feature is enabled. This feature allows the particle to react once in a one-sided manner when colliding with an object; after that, it won't react again until it exits and re-enters the collision. This feature is used for particles that lightly interact with surrounding objects when necessary.
◆ GetMass()
float QParticle::GetMass |
( |
| ) |
|
|
inline |
Returns the mass of the particle.
◆ GetOwnerMesh()
QMesh* QParticle::GetOwnerMesh |
( |
| ) |
|
|
inline |
Returns owner mesh of the particle. The Owner mesh is the mesh in which the particle is appointed.
◆ GetPosition()
Returns the local position of the particle.
◆ GetPreviousGlobalPosition()
QVector QParticle::GetPreviousGlobalPosition |
( |
| ) |
|
|
inline |
Returns the previous global position of the particle.
◆ GetRadius()
float QParticle::GetRadius |
( |
| ) |
|
|
inline |
Returns the radius of the particle.
◆ IsConnectedWithSpring()
bool QParticle::IsConnectedWithSpring |
( |
QParticle * |
particle | ) |
|
Checks if the given particle is connected to this particle via a spring. Returns true if a connection exists, otherwise returns false.
- Parameters
-
particle | A particle to check |
- Returns
- Returns true if a connection exists, otherwise returns false.
◆ SetEnabled()
QParticle * QParticle::SetEnabled |
( |
bool |
value | ) |
|
Sets whether the particle is enabled. Disabled particles are not exempt from the collision tests that involve the meshes they belong to, but the solutions of their manifolds are not applied. Additionally, in body types where particles can move freely individually (e.g., QSoftBody), force and velocity integrations are not applied.
- Note
- Disabled particles in QRigidBody objects may appear to move because they are transformed based on the position and rotation of the rigid body.
- Parameters
-
- Returns
- A pointer to the particle itself.
◆ SetForce()
Sets the force value of the particle. Set forces determine the force to be applied to a particle object at the next physics step from the current step.
- Parameters
-
- Returns
- A pointer to the particle itself.
◆ SetGlobalPosition()
Sets the global position of the particle.
- Parameters
-
value | A position value to set. |
- Returns
- A pointer to the particle itself.
◆ SetIsInternal()
QParticle * QParticle::SetIsInternal |
( |
bool |
value | ) |
|
Sets whether the particle is internal.Internal particle definition is used not for the particles that define the collision boundaries of a mesh, but for the grid particles inside these boundaries. This feature is important for simulation types that require different internal particle simulation, such as volume preserved soft bodies.
- Parameters
-
- Returns
- A pointer to the particle itself.
◆ SetIsLazy()
QParticle * QParticle::SetIsLazy |
( |
bool |
value | ) |
|
Sets whether the particle's lazy feature is enabled. This feature allows the particle to react once in a one-sided manner when colliding with an object; after that, it won't react again until it exits and re-enters the collision. This feature is used for particles that lightly interact with surrounding objects when necessary.
- Parameters
-
- Returns
- A pointer to the particle itself.
◆ SetMass()
QParticle * QParticle::SetMass |
( |
float |
value | ) |
|
Sets the mass of the particle.
- Parameters
-
- Returns
- A pointer to the particle itself.
◆ SetOwnerMesh()
Sets the owner mesh of the particle. Usually the owner mesh is defining when a particle added to a mesh.
- Parameters
-
mesh | A pointer of the mesh to set. |
- Returns
- A pointer to the particle itself.
◆ SetPosition()
Sets local position of the particle.
- Parameters
-
- Returns
- A pointer to the particle itself.
◆ SetPreviousGlobalPosition()
Sets the previous global position of the particle.
- Parameters
-
value | A position value to set. |
- Returns
- A pointer to the particle itself.
◆ SetRadius()
QParticle * QParticle::SetRadius |
( |
float |
radius | ) |
|
Sets the radius of the particle.
- Parameters
-
- Returns
- A pointer to the particle itself.
◆ manualDeletion
bool QParticle::manualDeletion =false |
By default, objects included in the physics engine are deleted by the destructors of the objects they belong to. When this flag is enabled, it indicates that this object should never be deleted by this engine. It is disabled by default, and it is recommended to keep it disabled. However, it can be used if needed for advanced purposes and integrations.
The documentation for this class was generated from the following files: