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>
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()
Sets 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.
◆ 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.
◆ 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.
◆ 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 local 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.
◆ 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.
◆ 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.
The documentation for this class was generated from the following files: