You can apply angle constraints between 3 particles using the QAngleConstraint. The physics engine uses QAngleConstraint to impose angle constraints between particles in objects already simulated using mass-spring models (e.g. QSoftBody objects). However, if the user wants, they can apply specific angle constraints between any 3 particles using QAngleConstraint. QWorld also provides methods to manage QAngleConstraint objects.
More...
#include <qangleconstraint.h>
You can apply angle constraints between 3 particles using the QAngleConstraint. The physics engine uses QAngleConstraint to impose angle constraints between particles in objects already simulated using mass-spring models (e.g. QSoftBody objects). However, if the user wants, they can apply specific angle constraints between any 3 particles using QAngleConstraint. QWorld also provides methods to manage QAngleConstraint objects.
- Warning
- QAngleConstraint will not work correctly on objects that are not simulated with particle dynamics, such as rigid bodies whose positions are fixed by transformations. QAngleConstraint relies on the ability to change the positions of particles with freedom of movement to apply constraints correctly.
◆ QAngleConstraint() [1/2]
Creates an angle constraint between three particles. But auto calculates min-max angle with the local positions of the particles.
- Parameters
-
particleA | A particle in the world. |
particleB | Another particle in the world. |
particleC | Another particle in the world. |
◆ QAngleConstraint() [2/2]
QAngleConstraint::QAngleConstraint |
( |
QParticle * |
particleA, |
|
|
QParticle * |
particleB, |
|
|
QParticle * |
particleC, |
|
|
float |
minimumAngle, |
|
|
float |
maximumAngle |
|
) |
| |
Creates an angle constraint between three particles.
- Parameters
-
particleA | A particle in the world. |
particleB | Another particle in the world. |
particleC | Another particle in the world. |
minimumAngle | The min-angle between three particles. |
maximumAngle | The max-angle between the three particles. |
◆ GetEnabled()
bool QAngleConstraint::GetEnabled |
( |
| ) |
|
|
inline |
Returns whether the spring is enabled.
◆ GetMaxAngle()
float QAngleConstraint::GetMaxAngle |
( |
| ) |
|
|
inline |
Returns the max-angle of the constraint
◆ GetMinAngle()
float QAngleConstraint::GetMinAngle |
( |
| ) |
|
|
inline |
Returns the min-angle of the constraint.
◆ GetParticleA()
QParticle* QAngleConstraint::GetParticleA |
( |
| ) |
|
|
inline |
Returns particleA of the angle constraint
◆ GetParticleB()
QParticle* QAngleConstraint::GetParticleB |
( |
| ) |
|
|
inline |
Returns particleB of the angle constraint
◆ GetParticleC()
QParticle* QAngleConstraint::GetParticleC |
( |
| ) |
|
|
inline |
Returns particleC of the angle constraint
◆ GetRigidity()
float QAngleConstraint::GetRigidity |
( |
| ) |
|
|
inline |
Returns the rigidity of the angle constraint
◆ SetEnabled()
Sets whether the angle constraint is enabled.
- Parameters
-
- Returns
- A pointer to the spring itself.
◆ SetMaxAngle()
Sets the max-angle of the constraint.
- Parameters
-
- Returns
- A pointer to the spring itself.
◆ SetMinAngle()
Sets the min-angle of the constraint.
- Parameters
-
- Returns
- A pointer to the spring itself.
◆ SetParticleA()
Sets particleA of the angle constraint.
- Parameters
-
particle | A pointer to the particle. |
- Returns
- A pointer to the spring itself.
◆ SetParticleB()
Sets particleB of the angle constraint.
- Parameters
-
particle | A pointer to the particle. |
- Returns
- A pointer to the spring itself.
◆ SetParticleC()
Sets particleC of the angle constraint.
- Parameters
-
particle | A pointer to the particle. |
- Returns
- A pointer to the spring itself.
◆ SetRigidity()
Sets the rigidity of the constraint.
- Parameters
-
rigidity | The rigidity value to set.It must be a value between 0.0 and 1.0. |
- Returns
- A pointer to the spring itself.
◆ Update()
void QAngleConstraint::Update |
( |
float |
specifiedRigidity = -1.0f , |
|
|
bool |
addToAccumulatedForces = false |
|
) |
| |
|
virtual |
Applies angle constraints and updates particle positions.
- Parameters
-
specifiedRigidity | This is the specific rigidity value that will be used instead of the current rigidity value of the constraint. By default, it is set to -1.0, which means it is disabled. It must be a value between 0.0 and 1.0. Otherwise, the original rigidity value defined for the constraint will be applied. |
addToAccumulatedForces | This property allows forces to be accumulated on particles for advanced purposes and then applies the average of these forces to the particle. If set to true, the necessary force for the constraint is not applied directly but is instead added to the particle's accumulated force collection. These properties are defined in the QParticle class and should only be used if you truly understand what you are doing." |
◆ manualDeletion
bool QAngleConstraint::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: