Hinge Constraint¶
-
struct nvHingeConstraint¶
Hinge constraint definition.
A hinge, also known as revolute or point, constraint allows the bodies to rotate around a common axis. Ensuring the relative orientation of the bodies remains fixed.
-
struct nvHingeConstraintInitializer¶
Hinge constraint initializer information.
This struct holds basic information for initializing and can be reused for multiple constraints if the bodies are changed.
Methods¶
-
nvConstraint *nvHingeConstraint_new(nvHingeConstraintInitializer init)¶
Create a new hinge constraint.
Leave one of the body parameters as
NULLto link the body to world. Don’t forget to change the anchor point to be in world space as well.Returns
NULLon error. Use nv_get_error to get more information.- Parameters:
init – Initializer info
- Returns:
-
nvRigidBody *nvHingeConstraint_get_body_a(const nvConstraint *cons)¶
Get body A of the constraint.
- Parameters:
cons – Constraint
- Returns:
-
nvRigidBody *nvHingeConstraint_get_body_b(const nvConstraint *cons)¶
Get body B of the constraint.
- Parameters:
cons – Constraint
- Returns:
-
void nvHingeConstraint_set_anchor(nvConstraint *cons, nvVector2 anchor)¶
Set anchor of the hinge constraint in world space.
- Parameters:
cons – Constraint
anchor – Anchor point in world space
-
nvVector2 nvHingeConstraint_get_anchor(const nvConstraint *cons)¶
Get anchor of the hinge constraint in world space.
- Parameters:
cons – Constraint
- Returns:
-
void nvHingeConstraint_set_limits(nvConstraint *cons, nv_bool limits)¶
Enable/disable angular limits.
- Parameters:
cons – Constraint
limits – Bool
-
nv_bool nvHingeConstraint_get_limits(const nvConstraint *cons)¶
Get whether angular limits is enabled or not.
- Parameters:
cons – Constraint
- Returns:
nv_bool
-
void nvHingeConstraint_set_upper_limit(nvConstraint *cons, nv_float upper_limit)¶
Set upper angular limit.
- Parameters:
cons – Constraint
upper_limit – Upper limit
-
nv_float nvHingeConstraint_get_upper_limit(const nvConstraint *cons)¶
Get upper angular limit.
- Parameters:
cons – Constraint
- Returns:
nv_float
-
void nvHingeConstraint_set_lower_limit(nvConstraint *cons, nv_float lower_limit)¶
Set lower angular limit.
- Parameters:
cons – Constraint
lower_limit – Lower limit
-
nv_float nvHingeConstraint_get_lower_limit(const nvConstraint *cons)¶
Get lower angular limit.
- Parameters:
cons – Constraint
- Returns:
nv_float
-
void nvHingeConstraint_set_max_force(nvConstraint *cons, nv_float max_force)¶
Set max force used to solve the constraint.
- Parameters:
cons – Constraint
max_force – Max force
-
nv_float nvHingeConstraint_get_max_force(const nvConstraint *cons)¶
Get max force used to solve the constraint.
- Parameters:
cons – Constraint
- Returns:
nv_float