QJoint objects serves to apply various distance constraints between rigid bodies. Additionally, you can create a distance constraint between any object and an imaginary point in space. Instead of separate methods for all fundamental constraints in physics engines, there is a set of property sets available. For example, setting a distance constraint to a distance of 0 creates a constraint known as a pin joint. By decreasing the rigidity of a set distance constraint, you obtain another type of joint called a spring joint. Enabling the groove mode prevents the constraint from being applied as long as the set distance is not exceeded, resulting in another type of joint called a groove joint. QWorld also provides methods to manage QJoint objects.
More...
#include <qjoint.h>
QJoint objects serves to apply various distance constraints between rigid bodies. Additionally, you can create a distance constraint between any object and an imaginary point in space. Instead of separate methods for all fundamental constraints in physics engines, there is a set of property sets available. For example, setting a distance constraint to a distance of 0 creates a constraint known as a pin joint. By decreasing the rigidity of a set distance constraint, you obtain another type of joint called a spring joint. Enabling the groove mode prevents the constraint from being applied as long as the set distance is not exceeded, resulting in another type of joint called a groove joint. QWorld also provides methods to manage QJoint objects.
◆ QJoint() [1/2]
Creates a joint between two rigid bodies. Anchor points will be locked to the corresponding position on the QRigidBody if the relevant QRigidBody is defined. If not defined, the anchor point will be assumed as a fixed point in space.
- Parameters
-
bodyA | A body in the world. If set to nullptr, anchorWorldPositionA will be a fixed point in space. |
anchorWorldPositionA | The anchorA position in world coordinates. |
anchorWorldPositionB | The anchorB position in world coordinates. |
bodyB | Another body in the world. If set to nullptr, anchorWorldPositionB will be a fixed point in space. |
◆ QJoint() [2/2]
Creates a joint between two rigid bodies with defined a single position to anchors. When you create a QJoint with an anchor parameter fixed to a single position, you obtain a QJoint with a constraint distance of 0, commonly known as a pin joint. If one of the QRigidBody parameters is not defined, the constraint will be applied not between two rigid body objects but between one rigid body object and an imaginary fixed point in space.
- Parameters
-
bodyA | A body in the world. If set to nullptr, anchorWorldPositionA will be a fixed point in space. |
commonAnchorWorldPosition | The common anchor position to set anchors of the joint in world coordinates. |
bodyB | Another body in the world. If set to nullptr, anchorWorldPositionB will be a fixed point in space. |
◆ GetAnchorAGlobalPosition()
QVector QJoint::GetAnchorAGlobalPosition |
( |
| ) |
|
|
inline |
Returns the position of anchorA of the joint in world coordinates.
◆ GetAnchorAPosition()
QVector QJoint::GetAnchorAPosition |
( |
| ) |
|
|
inline |
Returns the position of anchorA of the joint.If bodyA is defined, it returns the relative position of the anchor according to bodyA, otherwise, it returns the position of the anchor in world coordinates.
◆ GetAnchorBGlobalPosition()
QVector QJoint::GetAnchorBGlobalPosition |
( |
| ) |
|
|
inline |
Returns the position of anchorB of the joint in world coordinates.
◆ GetAnchorBPosition()
QVector QJoint::GetAnchorBPosition |
( |
| ) |
|
|
inline |
Returns the position of anchorB of the joint.If bodyB is defined, it returns the relative position of the anchor according to bodyA, otherwise, it returns the position of the anchor in world coordinates.
◆ GetBalance()
float QJoint::GetBalance |
( |
| ) |
|
|
inline |
Returns the balance value of the joint. 0.0 is the a-side, 1.0 is the b-side
◆ GetBodyA()
Returns bodyA of the joint.
◆ GetBodyB()
Returns bodyB of the joint.
◆ GetCollisionEnabled()
bool QJoint::GetCollisionEnabled |
( |
| ) |
|
|
inline |
Returns whether collisions are enabled between bodies of the joint.
◆ GetEnabled()
bool QJoint::GetEnabled |
( |
| ) |
|
|
inline |
Returns whether the joint is enabled.
◆ GetGrooveEnabled()
bool QJoint::GetGrooveEnabled |
( |
| ) |
|
|
inline |
Returns whether the groove mode of the joint enabled or not.
◆ GetLength()
float QJoint::GetLength |
( |
| ) |
|
|
inline |
Returns the length value of the joint.
◆ GetRigidity()
float QJoint::GetRigidity |
( |
| ) |
|
|
inline |
Returns the rigidity of the joint.
◆ SetAnchorAPosition()
Sets anchorA position of the joint.
- Parameters
-
worldPosition | A position to set in world coordinates. |
- Returns
- A pointer to the joint itself.
◆ SetAnchorBPosition()
Sets anchorB position of the joint.
- Parameters
-
worldPosition | A position to set in world coordinates. |
- Returns
- A pointer to the joint itself.
◆ SetBalance()
QJoint* QJoint::SetBalance |
( |
float |
value | ) |
|
|
inline |
Sets the force balance value of the joint, it's 0.5 as a default. 0.0 is the a-side, 1.0 is the b-side.
- Parameters
-
value | The balance value to set. It must be a value between 0.0 and 1.0. |
- Returns
- A pointer to the joint itself.
◆ SetBodyA()
Sets bodyA of the joint.
- Parameters
-
body | A pointer of the body to set. |
- Returns
- A pointer to the joint itself.
◆ SetBodyB()
Sets bodyB of the joint.
- Parameters
-
body | A pointer of the body to set. |
- Returns
- A pointer to the joint itself.
◆ SetCollisionEnabled()
QJoint * QJoint::SetCollisionEnabled |
( |
bool |
value | ) |
|
Sets whether collisions are enabled between bodies of the joint.
- Parameters
-
- Returns
- A pointer to the joint itself.
◆ SetEnabled()
QJoint* QJoint::SetEnabled |
( |
bool |
value | ) |
|
|
inline |
Sets whether the joint is enabled.
- Parameters
-
- Returns
- A pointer to the joint itself.
◆ SetGrooveEnabled()
QJoint* QJoint::SetGrooveEnabled |
( |
bool |
value | ) |
|
|
inline |
Sets whether the groove mode of the joint enabled or not. When groove mode is enabled in QJoints, distance constraint will only be applied when the set distance is exceeded.
- Parameters
-
- Returns
- A pointer to the joint itself.
◆ SetLength()
QJoint* QJoint::SetLength |
( |
float |
value | ) |
|
|
inline |
Sets the length value of the joint.
- Parameters
-
value | The length value to set.
|
- Returns
- A pointer to the joint itself.
◆ SetRigidity()
QJoint* QJoint::SetRigidity |
( |
float |
value | ) |
|
|
inline |
Sets the rigidity of the joint.
- Parameters
-
value | The rigidity value to set. It must be a value between 0.0 and 1.0. |
- Returns
- A pointer to the joint itself.
◆ Update()
Updates the constraints of the joint.
The documentation for this class was generated from the following files:
- QuarkPhysics/qjoint.h
- QuarkPhysics/qjoint.cpp