Rapier C — 2D / f32 0.36.0+c.0
Loading...
Searching...
No Matches
Joints

Impulse joints and reduced-coordinate articulations. More...

Data Structures

struct  R2JointLimits
 Lower and upper axis limits in length units or radians. More...
struct  R2JointMotor
 Position/velocity motor settings for one joint axis. More...
struct  R2JointDesc
 Copyable joint configuration. More...
struct  R2ImpulseJointHandle
 Copyable non-owning handle: world pointer plus entity index and generation. More...
struct  R2MultibodyJointHandle
 Copyable non-owning handle: world pointer plus entity index and generation. More...
struct  R2JointBodies
 World-bound handles of the two connected bodies. More...
struct  R2JointImpulses
 Impulses applied by an impulse joint during the last step, along the axes of its joint frame. More...

Macros

#define R2_JOINT_DOF_COUNT   3
 Number of translational and angular joint axes in this dimension.
#define R2_MOTOR_ACCELERATION_BASED   0
 Motor stiffness and damping are acceleration-based, independent of mass.
#define R2_MOTOR_FORCE_BASED   1
 Motor stiffness and damping are force-based, so response depends on mass.
#define R2_AXIS_LIN_X   0
 Joint axis index for translation along local X.
#define R2_AXIS_LIN_Y   1
 Joint axis index for translation along local Y.
#define R2_AXIS_ANG_X   2
 Joint axis index for the first rotation: Z in 2D, local X in 3D.
#define R2_JOINT_FIXED_AXES   7
 Locked-axis mask for a fixed joint: all translations and rotations.
#define R2_JOINT_REVOLUTE_AXES   3
 Locked-axis mask for a revolute joint: only the first angular axis is free.
#define R2_JOINT_PRISMATIC_AXES   6
 Locked-axis mask for a prismatic joint: only translation along local X is free.
#define R2_MULTIBODY_JOINTS_ARE_KINEMATIC   1
 Insert reduced-coordinate joints as kinematic articulations.
#define R2_MULTIBODY_DISABLE_SELF_CONTACTS   2
 Disable contacts between colliders of the inserted articulation.
#define R2_MULTIBODY_SKIP_LOOP_CLOSURES   4
 Do not insert MJCF equality constraints (loop closures) as impulse joints.
#define R2_MULTIBODY_SKIP_JOINT_MOTORS   8
 Do not import joint motors into the articulation.
#define R2_MULTIBODY_SKIP_JOINT_LIMITS   16
 Do not import joint limits into the articulation.
#define R2_MULTIBODY_SKIP_JOINT_SPRINGS   32
 Do not import joint springs into the articulation.

Typedefs

typedef struct R2JointLimits R2JointLimits
 Lower and upper axis limits in length units or radians.
typedef struct R2JointMotor R2JointMotor
 Position/velocity motor settings for one joint axis.
typedef struct R2JointDesc R2JointDesc
 Copyable joint configuration.
typedef struct R2ImpulseJointHandle R2ImpulseJointHandle
 Copyable non-owning handle: world pointer plus entity index and generation.
typedef struct R2MultibodyJointHandle R2MultibodyJointHandle
 Copyable non-owning handle: world pointer plus entity index and generation.
typedef struct R2JointBodies R2JointBodies
 World-bound handles of the two connected bodies.
typedef R2Bool(*) R2IkJointCanMove(void *, struct R2RigidBodyHandle)
 Optional per-link filter, called synchronously.
typedef struct R2JointImpulses R2JointImpulses
 Impulses applied by an impulse joint during the last step, along the axes of its joint frame.

Functions

struct R2JointDesc r2DefaultJointDesc (void)
 Return native default joint desc.
struct R2JointDesc r2FixedJointDesc (void)
 Return a fixed joint description with native defaults; no allocation.
struct R2JointDesc r2RevoluteJointDesc (void)
 Return a revolute joint description with native defaults; no allocation.
struct R2JointDesc r2PrismaticJointDesc (struct R2Vector axis_vector)
 Returns a joint description.
struct R2JointDesc r2RopeJointDesc (R2Real length)
 Return a rope joint description with native defaults; no allocation.
struct R2JointDesc r2SpringJointDesc (R2Real length, R2Real stiffness, R2Real damping)
 Return a spring joint description with native defaults; no allocation.
struct R2JointDesc r2PinSlotJointDesc (struct R2Vector axis_vector)
 Returns a joint description.
struct R2ImpulseJointHandle r2InsertImpulseJoint (struct R2RigidBodyHandle body1, struct R2RigidBodyHandle body2, const struct R2JointDesc *joint)
 Create an impulse joint connecting two bodies in the same world.
struct R2MultibodyJointHandle r2InsertMultibodyJoint (struct R2RigidBodyHandle body1, struct R2RigidBodyHandle body2, const struct R2JointDesc *joint)
 Create an articulation joint between bodies in the same world.
R2Status r2RemoveImpulseJoint (struct R2ImpulseJointHandle handle, R2Bool wake_up)
 Remove an impulse joint.
size_t r2ImpulseJointHandles (const struct R2World *world, struct R2ImpulseJointHandle *buffer, size_t capacity)
 Copy entity handles.
R2Status r2RemoveMultibodyJoint (struct R2MultibodyJointHandle handle, R2Bool wake_up)
 Remove an articulation joint.
size_t r2MultibodyJointHandles (const struct R2World *world, struct R2MultibodyJointHandle *buffer, size_t capacity)
 Copy entity handles.
struct R2JointBodies r2ImpulseJoint_Bodies (struct R2ImpulseJointHandle handle)
 Return the two bodies connected by an impulse joint.
struct R2InverseKinematicsOptions r2DefaultInverseKinematicsOptions (void)
 Return native default inverse kinematics options.
size_t r2MultibodyJoint_Ndofs (struct R2MultibodyJointHandle handle)
 Return the degrees of freedom of the whole multibody containing the joint (not of the joint alone), including the free root of a dynamic multibody.
R2Status r2MultibodyJoint_InverseKinematics (struct R2MultibodyJointHandle handle, const struct R2InverseKinematicsOptions *options, struct R2Pose target, R2IkJointCanMove can_move, void *user_data, R2Real *displacements, size_t count)
 Read/write displacement buffer must contain exactly ndofs entries; zero it for a fresh solve.
R2Status r2MultibodyJoint_ApplyDisplacements (struct R2MultibodyJointHandle handle, const R2Real *displacements, size_t count)
 Apply generalized articulation displacements in native degree-of-freedom order.
size_t r2MultibodyJoint_GeneralizedVelocity (struct R2MultibodyJointHandle handle, R2Real *buffer, size_t capacity)
 Copy the articulation generalized velocities in native degree-of-freedom order.
R2Status r2MultibodyJoint_SetGeneralizedVelocity (struct R2MultibodyJointHandle handle, const R2Real *values, size_t count)
 Replace articulation generalized velocities; the array length must match its degrees of freedom.
struct R2JointDesc r2ImpulseJoint_Desc (struct R2ImpulseJointHandle handle)
 Copies joint configuration without returning a borrowed joint pointer.
R2Status r2ImpulseJoint_SetDesc (struct R2ImpulseJointHandle handle, const struct R2JointDesc *desc, R2Bool wake_up)
 Replaces configuration after validation, resetting cached limit/motor impulses.
R2Status r2JointDesc_SetLocalFrame1 (struct R2JointDesc *desc, struct R2Pose value)
 Set the joint desc joint frame relative to body 1.
R2Status r2ImpulseJoint_SetLocalFrame1 (struct R2ImpulseJointHandle handle, struct R2Pose value, R2Bool wake_up)
 Set the impulse joint joint frame relative to body 1.
R2Status r2JointDesc_SetLocalFrame2 (struct R2JointDesc *desc, struct R2Pose value)
 Set the joint desc joint frame relative to body 2.
R2Status r2ImpulseJoint_SetLocalFrame2 (struct R2ImpulseJointHandle handle, struct R2Pose value, R2Bool wake_up)
 Set the impulse joint joint frame relative to body 2.
R2Status r2JointDesc_SetLocalAnchor1 (struct R2JointDesc *desc, struct R2Vector value)
 Set the joint desc joint anchor relative to body 1.
R2Status r2ImpulseJoint_SetLocalAnchor1 (struct R2ImpulseJointHandle handle, struct R2Vector value, R2Bool wake_up)
 Set the impulse joint joint anchor relative to body 1.
R2Status r2JointDesc_SetLocalAnchor2 (struct R2JointDesc *desc, struct R2Vector value)
 Set the joint desc joint anchor relative to body 2.
R2Status r2ImpulseJoint_SetLocalAnchor2 (struct R2ImpulseJointHandle handle, struct R2Vector value, R2Bool wake_up)
 Set the impulse joint joint anchor relative to body 2.
R2Status r2JointDesc_SetContactsEnabled (struct R2JointDesc *desc, R2Bool value)
 Enable or disable allowing contacts between connected bodies for the joint desc.
R2Status r2ImpulseJoint_SetContactsEnabled (struct R2ImpulseJointHandle handle, R2Bool value, R2Bool wake_up)
 Enable or disable allowing contacts between connected bodies for the impulse joint.
R2Status r2JointDesc_SetEnabled (struct R2JointDesc *desc, R2Bool value)
 Enable or disable the joint desc.
R2Status r2ImpulseJoint_SetEnabled (struct R2ImpulseJointHandle handle, R2Bool value, R2Bool wake_up)
 Enable or disable the impulse joint.
R2Status r2JointDesc_SetSoftness (struct R2JointDesc *desc, struct R2SpringCoefficients value)
 Set the joint desc joint spring coefficients.
R2Status r2ImpulseJoint_SetSoftness (struct R2ImpulseJointHandle handle, struct R2SpringCoefficients value, R2Bool wake_up)
 Set the impulse joint joint spring coefficients.
R2Status r2JointDesc_SetLockedAxes (struct R2JointDesc *desc, uint8_t value)
 Set the joint desc translation/rotation lock bitmask.
R2Status r2ImpulseJoint_SetLockedAxes (struct R2ImpulseJointHandle handle, uint8_t value, R2Bool wake_up)
 Set the impulse joint translation/rotation lock bitmask.
R2Status r2JointDesc_SetLimitAxes (struct R2JointDesc *desc, uint8_t value)
 Set the joint desc joint axis mask with limits enabled.
R2Status r2ImpulseJoint_SetLimitAxes (struct R2ImpulseJointHandle handle, uint8_t value, R2Bool wake_up)
 Set the impulse joint joint axis mask with limits enabled.
R2Status r2JointDesc_SetMotorAxes (struct R2JointDesc *desc, uint8_t value)
 Set the joint desc joint axis mask with motors enabled.
R2Status r2ImpulseJoint_SetMotorAxes (struct R2ImpulseJointHandle handle, uint8_t value, R2Bool wake_up)
 Set the impulse joint joint axis mask with motors enabled.
R2Status r2JointDesc_SetCoupledAxes (struct R2JointDesc *desc, uint8_t value)
 Set the joint desc coupled joint axis mask.
R2Status r2ImpulseJoint_SetCoupledAxes (struct R2ImpulseJointHandle handle, uint8_t value, R2Bool wake_up)
 Set the impulse joint coupled joint axis mask.
R2Status r2JointDesc_SetLocalAxis1 (struct R2JointDesc *desc, struct R2Vector value)
 Set the joint desc joint principal axis in body 1 local coordinates.
R2Status r2ImpulseJoint_SetLocalAxis1 (struct R2ImpulseJointHandle handle, struct R2Vector value, R2Bool wake_up)
 Set the impulse joint joint principal axis in body 1 local coordinates.
R2Status r2JointDesc_SetLocalAxis2 (struct R2JointDesc *desc, struct R2Vector value)
 Set the joint desc joint principal axis in body 2 local coordinates.
R2Status r2ImpulseJoint_SetLocalAxis2 (struct R2ImpulseJointHandle handle, struct R2Vector value, R2Bool wake_up)
 Set the impulse joint joint principal axis in body 2 local coordinates.
R2Status r2JointDesc_SetLimits (struct R2JointDesc *desc, uint32_t joint_axis, R2Real min, R2Real max)
 Set the joint desc minimum and maximum limits on an axis (linear distance or angular radians).
R2Status r2ImpulseJoint_SetLimits (struct R2ImpulseJointHandle handle, uint32_t joint_axis, R2Real min, R2Real max, R2Bool wake_up)
 Set the impulse joint minimum and maximum limits on an axis (linear distance or angular radians).
R2Status r2JointDesc_SetMotor (struct R2JointDesc *desc, uint32_t joint_axis, R2Real target_position, R2Real target_velocity, R2Real stiffness, R2Real damping)
 Set the joint desc motor position/velocity targets and spring coefficients on an axis.
R2Status r2ImpulseJoint_SetMotor (struct R2ImpulseJointHandle handle, uint32_t joint_axis, R2Real target_position, R2Real target_velocity, R2Real stiffness, R2Real damping, R2Bool wake_up)
 Set the impulse joint motor position/velocity targets and spring coefficients on an axis.
R2Status r2JointDesc_SetMotorMaxForce (struct R2JointDesc *desc, uint32_t joint_axis, R2Real max_force)
 Set the joint desc maximum motor force or torque on an axis.
R2Status r2ImpulseJoint_SetMotorMaxForce (struct R2ImpulseJointHandle handle, uint32_t joint_axis, R2Real max_force, R2Bool wake_up)
 Set the impulse joint maximum motor force or torque on an axis.
R2Status r2JointDesc_SetMotorModel (struct R2JointDesc *desc, uint32_t joint_axis, uint32_t model)
 Set the joint desc motor model on an axis (0 = acceleration-based, 1 = force-based).
R2Status r2ImpulseJoint_SetMotorModel (struct R2ImpulseJointHandle handle, uint32_t joint_axis, uint32_t model, R2Bool wake_up)
 Set the impulse joint motor model on an axis (0 = acceleration-based, 1 = force-based).
R2Status r2JointDesc_SetUserData (struct R2JointDesc *desc, struct R2UserData value)
 Set the joint desc application-owned 128-bit user value.
R2Status r2ImpulseJoint_SetUserData (struct R2ImpulseJointHandle handle, struct R2UserData value, R2Bool wake_up)
 Set the impulse joint application-owned 128-bit user value.
R2Status r2JointDesc_SetMotorPosition (struct R2JointDesc *desc, uint32_t joint_axis, R2Real target_position, R2Real stiffness, R2Real damping)
 Set the joint desc motor position target and spring coefficients on an axis.
R2Status r2ImpulseJoint_SetMotorPosition (struct R2ImpulseJointHandle handle, uint32_t joint_axis, R2Real target_position, R2Real stiffness, R2Real damping, R2Bool wake_up)
 Set the impulse joint motor position target and spring coefficients on an axis.
R2Status r2JointDesc_SetMotorVelocity (struct R2JointDesc *desc, uint32_t joint_axis, R2Real target_velocity, R2Real factor)
 Set the joint desc motor velocity target and damping factor on an axis.
R2Status r2ImpulseJoint_SetMotorVelocity (struct R2ImpulseJointHandle handle, uint32_t joint_axis, R2Real target_velocity, R2Real factor, R2Bool wake_up)
 Set the impulse joint motor velocity target and damping factor on an axis.
struct R2JointImpulses r2ImpulseJoint_Impulses (struct R2ImpulseJointHandle handle)
 Return the impulses applied by the impulse joint during the last step.
struct R2UserData r2ImpulseJoint_UserData (struct R2ImpulseJointHandle handle)
 Return the impulse joint application-owned 128-bit user value.
size_t r2ImpulseJointCount (const struct R2World *world)
 Return the number of impulse joints in the world.
size_t r2MultibodyJointCount (const struct R2World *world)
 Return the number of multibody joints in the world, which is the number of handles copied by r2MultibodyJointHandles.
struct R2JointDesc r2MultibodyJoint_Desc (struct R2MultibodyJointHandle handle)
 Copies the multibody joint configuration without returning a borrowed joint pointer.
R2Status r2MultibodyJoint_SetDesc (struct R2MultibodyJointHandle handle, const struct R2JointDesc *desc, R2Bool wake_up)
 Replaces the multibody joint configuration after validation.
struct R2JointBodies r2MultibodyJoint_Bodies (struct R2MultibodyJointHandle handle)
 Return the two bodies connected by a multibody joint: its parent link, then its own link.

Detailed Description

Impulse joints and reduced-coordinate articulations.

Axis indices are translation X/Y[/Z], then rotation Z in 2D or X/Y/Z in 3D. Masks use one bit per axis.

Macro Definition Documentation

◆ R2_AXIS_ANG_X

#define R2_AXIS_ANG_X   2

Joint axis index for the first rotation: Z in 2D, local X in 3D.

◆ R2_AXIS_LIN_X

#define R2_AXIS_LIN_X   0

Joint axis index for translation along local X.

◆ R2_AXIS_LIN_Y

#define R2_AXIS_LIN_Y   1

Joint axis index for translation along local Y.

◆ R2_JOINT_DOF_COUNT

#define R2_JOINT_DOF_COUNT   3

Number of translational and angular joint axes in this dimension.

◆ R2_JOINT_FIXED_AXES

#define R2_JOINT_FIXED_AXES   7

Locked-axis mask for a fixed joint: all translations and rotations.

◆ R2_JOINT_PRISMATIC_AXES

#define R2_JOINT_PRISMATIC_AXES   6

Locked-axis mask for a prismatic joint: only translation along local X is free.

◆ R2_JOINT_REVOLUTE_AXES

#define R2_JOINT_REVOLUTE_AXES   3

Locked-axis mask for a revolute joint: only the first angular axis is free.

◆ R2_MOTOR_ACCELERATION_BASED

#define R2_MOTOR_ACCELERATION_BASED   0

Motor stiffness and damping are acceleration-based, independent of mass.

◆ R2_MOTOR_FORCE_BASED

#define R2_MOTOR_FORCE_BASED   1

Motor stiffness and damping are force-based, so response depends on mass.

◆ R2_MULTIBODY_DISABLE_SELF_CONTACTS

#define R2_MULTIBODY_DISABLE_SELF_CONTACTS   2

Disable contacts between colliders of the inserted articulation.

◆ R2_MULTIBODY_JOINTS_ARE_KINEMATIC

#define R2_MULTIBODY_JOINTS_ARE_KINEMATIC   1

Insert reduced-coordinate joints as kinematic articulations.

◆ R2_MULTIBODY_SKIP_JOINT_LIMITS

#define R2_MULTIBODY_SKIP_JOINT_LIMITS   16

Do not import joint limits into the articulation.

MJCF only: URDF insertion rejects it.

◆ R2_MULTIBODY_SKIP_JOINT_MOTORS

#define R2_MULTIBODY_SKIP_JOINT_MOTORS   8

Do not import joint motors into the articulation.

MJCF only: URDF insertion rejects it.

◆ R2_MULTIBODY_SKIP_JOINT_SPRINGS

#define R2_MULTIBODY_SKIP_JOINT_SPRINGS   32

Do not import joint springs into the articulation.

MJCF only: URDF insertion rejects it.

◆ R2_MULTIBODY_SKIP_LOOP_CLOSURES

#define R2_MULTIBODY_SKIP_LOOP_CLOSURES   4

Do not insert MJCF equality constraints (loop closures) as impulse joints.

MJCF only: URDF insertion rejects it.

Typedef Documentation

◆ R2IkJointCanMove

typedef R2Bool(*) R2IkJointCanMove(void *, struct R2RigidBodyHandle)

Optional per-link filter, called synchronously.

Must not reenter or retain physics objects.

◆ R2ImpulseJointHandle

typedef struct R2ImpulseJointHandle R2ImpulseJointHandle

Copyable non-owning handle: world pointer plus entity index and generation.

The world must remain alive throughout every use. Copying does not retain it. UINT32_MAX/UINT32_MAX with a NULL world is invalid.

◆ R2JointBodies

typedef struct R2JointBodies R2JointBodies

World-bound handles of the two connected bodies.

◆ R2JointDesc

typedef struct R2JointDesc R2JointDesc

Copyable joint configuration.

Limits/motors take effect when their axis mask is enabled. Solver impulses are deliberately excluded. Applying data resets cached limit and motor impulses.

◆ R2JointImpulses

typedef struct R2JointImpulses R2JointImpulses

Impulses applied by an impulse joint during the last step, along the axes of its joint frame.

◆ R2JointLimits

typedef struct R2JointLimits R2JointLimits

Lower and upper axis limits in length units or radians.

◆ R2JointMotor

typedef struct R2JointMotor R2JointMotor

Position/velocity motor settings for one joint axis.

◆ R2MultibodyJointHandle

typedef struct R2MultibodyJointHandle R2MultibodyJointHandle

Copyable non-owning handle: world pointer plus entity index and generation.

The world must remain alive throughout every use. Copying does not retain it. UINT32_MAX/UINT32_MAX with a NULL world is invalid.

Function Documentation

◆ r2DefaultInverseKinematicsOptions()

struct R2InverseKinematicsOptions r2DefaultInverseKinematicsOptions ( void )

Return native default inverse kinematics options.

This POD value owns no resources.

◆ r2DefaultJointDesc()

struct R2JointDesc r2DefaultJointDesc ( void )

Return native default joint desc.

This POD value owns no resources.

◆ r2FixedJointDesc()

struct R2JointDesc r2FixedJointDesc ( void )

Return a fixed joint description with native defaults; no allocation.

◆ r2ImpulseJoint_Bodies()

struct R2JointBodies r2ImpulseJoint_Bodies ( struct R2ImpulseJointHandle handle)

Return the two bodies connected by an impulse joint.

◆ r2ImpulseJoint_Desc()

struct R2JointDesc r2ImpulseJoint_Desc ( struct R2ImpulseJointHandle handle)

Copies joint configuration without returning a borrowed joint pointer.

◆ r2ImpulseJoint_Impulses()

struct R2JointImpulses r2ImpulseJoint_Impulses ( struct R2ImpulseJointHandle handle)

Return the impulses applied by the impulse joint during the last step.

They are zero before its first step, and their components are expressed along the axes of the joint frame.

◆ r2ImpulseJoint_SetContactsEnabled()

R2Status r2ImpulseJoint_SetContactsEnabled ( struct R2ImpulseJointHandle handle,
R2Bool value,
R2Bool wake_up )

Enable or disable allowing contacts between connected bodies for the impulse joint.

wake_up = 1 wakes affected bodies; 0 preserves their sleep state.

◆ r2ImpulseJoint_SetCoupledAxes()

R2Status r2ImpulseJoint_SetCoupledAxes ( struct R2ImpulseJointHandle handle,
uint8_t value,
R2Bool wake_up )

Set the impulse joint coupled joint axis mask.

wake_up = 1 wakes affected bodies; 0 preserves their sleep state.

◆ r2ImpulseJoint_SetDesc()

R2Status r2ImpulseJoint_SetDesc ( struct R2ImpulseJointHandle handle,
const struct R2JointDesc * desc,
R2Bool wake_up )

Replaces configuration after validation, resetting cached limit/motor impulses.

wake_up = 1 wakes affected bodies; 0 preserves their sleep state.

◆ r2ImpulseJoint_SetEnabled()

R2Status r2ImpulseJoint_SetEnabled ( struct R2ImpulseJointHandle handle,
R2Bool value,
R2Bool wake_up )

Enable or disable the impulse joint.

wake_up = 1 wakes affected bodies; 0 preserves their sleep state.

◆ r2ImpulseJoint_SetLimitAxes()

R2Status r2ImpulseJoint_SetLimitAxes ( struct R2ImpulseJointHandle handle,
uint8_t value,
R2Bool wake_up )

Set the impulse joint joint axis mask with limits enabled.

wake_up = 1 wakes affected bodies; 0 preserves their sleep state.

◆ r2ImpulseJoint_SetLimits()

R2Status r2ImpulseJoint_SetLimits ( struct R2ImpulseJointHandle handle,
uint32_t joint_axis,
R2Real min,
R2Real max,
R2Bool wake_up )

Set the impulse joint minimum and maximum limits on an axis (linear distance or angular radians).

wake_up = 1 wakes affected bodies; 0 preserves their sleep state.

◆ r2ImpulseJoint_SetLocalAnchor1()

R2Status r2ImpulseJoint_SetLocalAnchor1 ( struct R2ImpulseJointHandle handle,
struct R2Vector value,
R2Bool wake_up )

Set the impulse joint joint anchor relative to body 1.

wake_up = 1 wakes affected bodies; 0 preserves their sleep state.

◆ r2ImpulseJoint_SetLocalAnchor2()

R2Status r2ImpulseJoint_SetLocalAnchor2 ( struct R2ImpulseJointHandle handle,
struct R2Vector value,
R2Bool wake_up )

Set the impulse joint joint anchor relative to body 2.

wake_up = 1 wakes affected bodies; 0 preserves their sleep state.

◆ r2ImpulseJoint_SetLocalAxis1()

R2Status r2ImpulseJoint_SetLocalAxis1 ( struct R2ImpulseJointHandle handle,
struct R2Vector value,
R2Bool wake_up )

Set the impulse joint joint principal axis in body 1 local coordinates.

wake_up = 1 wakes affected bodies; 0 preserves their sleep state.

◆ r2ImpulseJoint_SetLocalAxis2()

R2Status r2ImpulseJoint_SetLocalAxis2 ( struct R2ImpulseJointHandle handle,
struct R2Vector value,
R2Bool wake_up )

Set the impulse joint joint principal axis in body 2 local coordinates.

wake_up = 1 wakes affected bodies; 0 preserves their sleep state.

◆ r2ImpulseJoint_SetLocalFrame1()

R2Status r2ImpulseJoint_SetLocalFrame1 ( struct R2ImpulseJointHandle handle,
struct R2Pose value,
R2Bool wake_up )

Set the impulse joint joint frame relative to body 1.

wake_up = 1 wakes affected bodies; 0 preserves their sleep state.

◆ r2ImpulseJoint_SetLocalFrame2()

R2Status r2ImpulseJoint_SetLocalFrame2 ( struct R2ImpulseJointHandle handle,
struct R2Pose value,
R2Bool wake_up )

Set the impulse joint joint frame relative to body 2.

wake_up = 1 wakes affected bodies; 0 preserves their sleep state.

◆ r2ImpulseJoint_SetLockedAxes()

R2Status r2ImpulseJoint_SetLockedAxes ( struct R2ImpulseJointHandle handle,
uint8_t value,
R2Bool wake_up )

Set the impulse joint translation/rotation lock bitmask.

wake_up = 1 wakes affected bodies; 0 preserves their sleep state.

◆ r2ImpulseJoint_SetMotor()

R2Status r2ImpulseJoint_SetMotor ( struct R2ImpulseJointHandle handle,
uint32_t joint_axis,
R2Real target_position,
R2Real target_velocity,
R2Real stiffness,
R2Real damping,
R2Bool wake_up )

Set the impulse joint motor position/velocity targets and spring coefficients on an axis.

wake_up = 1 wakes affected bodies; 0 preserves their sleep state.

◆ r2ImpulseJoint_SetMotorAxes()

R2Status r2ImpulseJoint_SetMotorAxes ( struct R2ImpulseJointHandle handle,
uint8_t value,
R2Bool wake_up )

Set the impulse joint joint axis mask with motors enabled.

wake_up = 1 wakes affected bodies; 0 preserves their sleep state.

◆ r2ImpulseJoint_SetMotorMaxForce()

R2Status r2ImpulseJoint_SetMotorMaxForce ( struct R2ImpulseJointHandle handle,
uint32_t joint_axis,
R2Real max_force,
R2Bool wake_up )

Set the impulse joint maximum motor force or torque on an axis.

wake_up = 1 wakes affected bodies; 0 preserves their sleep state.

◆ r2ImpulseJoint_SetMotorModel()

R2Status r2ImpulseJoint_SetMotorModel ( struct R2ImpulseJointHandle handle,
uint32_t joint_axis,
uint32_t model,
R2Bool wake_up )

Set the impulse joint motor model on an axis (0 = acceleration-based, 1 = force-based).

wake_up = 1 wakes affected bodies; 0 preserves their sleep state.

◆ r2ImpulseJoint_SetMotorPosition()

R2Status r2ImpulseJoint_SetMotorPosition ( struct R2ImpulseJointHandle handle,
uint32_t joint_axis,
R2Real target_position,
R2Real stiffness,
R2Real damping,
R2Bool wake_up )

Set the impulse joint motor position target and spring coefficients on an axis.

wake_up = 1 wakes affected bodies; 0 preserves their sleep state.

◆ r2ImpulseJoint_SetMotorVelocity()

R2Status r2ImpulseJoint_SetMotorVelocity ( struct R2ImpulseJointHandle handle,
uint32_t joint_axis,
R2Real target_velocity,
R2Real factor,
R2Bool wake_up )

Set the impulse joint motor velocity target and damping factor on an axis.

wake_up = 1 wakes affected bodies; 0 preserves their sleep state.

◆ r2ImpulseJoint_SetSoftness()

R2Status r2ImpulseJoint_SetSoftness ( struct R2ImpulseJointHandle handle,
struct R2SpringCoefficients value,
R2Bool wake_up )

Set the impulse joint joint spring coefficients.

wake_up = 1 wakes affected bodies; 0 preserves their sleep state.

◆ r2ImpulseJoint_SetUserData()

R2Status r2ImpulseJoint_SetUserData ( struct R2ImpulseJointHandle handle,
struct R2UserData value,
R2Bool wake_up )

Set the impulse joint application-owned 128-bit user value.

wake_up = 1 wakes affected bodies; 0 preserves their sleep state.

◆ r2ImpulseJoint_UserData()

struct R2UserData r2ImpulseJoint_UserData ( struct R2ImpulseJointHandle handle)

Return the impulse joint application-owned 128-bit user value.

◆ r2ImpulseJointCount()

size_t r2ImpulseJointCount ( const struct R2World * world)

Return the number of impulse joints in the world.

◆ r2ImpulseJointHandles()

size_t r2ImpulseJointHandles ( const struct R2World * world,
struct R2ImpulseJointHandle * buffer,
size_t capacity )

Copy entity handles.

See also
Arrays and output buffers

◆ r2InsertImpulseJoint()

struct R2ImpulseJointHandle r2InsertImpulseJoint ( struct R2RigidBodyHandle body1,
struct R2RigidBodyHandle body2,
const struct R2JointDesc * joint )

Create an impulse joint connecting two bodies in the same world.

The world owns the joint; wake_up wakes the connected bodies.

◆ r2InsertMultibodyJoint()

struct R2MultibodyJointHandle r2InsertMultibodyJoint ( struct R2RigidBodyHandle body1,
struct R2RigidBodyHandle body2,
const struct R2JointDesc * joint )

Create an articulation joint between bodies in the same world.

Returns an invalid handle on failure; check r2LastStatus.

◆ r2JointDesc_SetContactsEnabled()

R2Status r2JointDesc_SetContactsEnabled ( struct R2JointDesc * desc,
R2Bool value )

Enable or disable allowing contacts between connected bodies for the joint desc.

◆ r2JointDesc_SetCoupledAxes()

R2Status r2JointDesc_SetCoupledAxes ( struct R2JointDesc * desc,
uint8_t value )

Set the joint desc coupled joint axis mask.

◆ r2JointDesc_SetEnabled()

R2Status r2JointDesc_SetEnabled ( struct R2JointDesc * desc,
R2Bool value )

Enable or disable the joint desc.

◆ r2JointDesc_SetLimitAxes()

R2Status r2JointDesc_SetLimitAxes ( struct R2JointDesc * desc,
uint8_t value )

Set the joint desc joint axis mask with limits enabled.

◆ r2JointDesc_SetLimits()

R2Status r2JointDesc_SetLimits ( struct R2JointDesc * desc,
uint32_t joint_axis,
R2Real min,
R2Real max )

Set the joint desc minimum and maximum limits on an axis (linear distance or angular radians).

◆ r2JointDesc_SetLocalAnchor1()

R2Status r2JointDesc_SetLocalAnchor1 ( struct R2JointDesc * desc,
struct R2Vector value )

Set the joint desc joint anchor relative to body 1.

◆ r2JointDesc_SetLocalAnchor2()

R2Status r2JointDesc_SetLocalAnchor2 ( struct R2JointDesc * desc,
struct R2Vector value )

Set the joint desc joint anchor relative to body 2.

◆ r2JointDesc_SetLocalAxis1()

R2Status r2JointDesc_SetLocalAxis1 ( struct R2JointDesc * desc,
struct R2Vector value )

Set the joint desc joint principal axis in body 1 local coordinates.

◆ r2JointDesc_SetLocalAxis2()

R2Status r2JointDesc_SetLocalAxis2 ( struct R2JointDesc * desc,
struct R2Vector value )

Set the joint desc joint principal axis in body 2 local coordinates.

◆ r2JointDesc_SetLocalFrame1()

R2Status r2JointDesc_SetLocalFrame1 ( struct R2JointDesc * desc,
struct R2Pose value )

Set the joint desc joint frame relative to body 1.

◆ r2JointDesc_SetLocalFrame2()

R2Status r2JointDesc_SetLocalFrame2 ( struct R2JointDesc * desc,
struct R2Pose value )

Set the joint desc joint frame relative to body 2.

◆ r2JointDesc_SetLockedAxes()

R2Status r2JointDesc_SetLockedAxes ( struct R2JointDesc * desc,
uint8_t value )

Set the joint desc translation/rotation lock bitmask.

◆ r2JointDesc_SetMotor()

R2Status r2JointDesc_SetMotor ( struct R2JointDesc * desc,
uint32_t joint_axis,
R2Real target_position,
R2Real target_velocity,
R2Real stiffness,
R2Real damping )

Set the joint desc motor position/velocity targets and spring coefficients on an axis.

◆ r2JointDesc_SetMotorAxes()

R2Status r2JointDesc_SetMotorAxes ( struct R2JointDesc * desc,
uint8_t value )

Set the joint desc joint axis mask with motors enabled.

◆ r2JointDesc_SetMotorMaxForce()

R2Status r2JointDesc_SetMotorMaxForce ( struct R2JointDesc * desc,
uint32_t joint_axis,
R2Real max_force )

Set the joint desc maximum motor force or torque on an axis.

◆ r2JointDesc_SetMotorModel()

R2Status r2JointDesc_SetMotorModel ( struct R2JointDesc * desc,
uint32_t joint_axis,
uint32_t model )

Set the joint desc motor model on an axis (0 = acceleration-based, 1 = force-based).

◆ r2JointDesc_SetMotorPosition()

R2Status r2JointDesc_SetMotorPosition ( struct R2JointDesc * desc,
uint32_t joint_axis,
R2Real target_position,
R2Real stiffness,
R2Real damping )

Set the joint desc motor position target and spring coefficients on an axis.

◆ r2JointDesc_SetMotorVelocity()

R2Status r2JointDesc_SetMotorVelocity ( struct R2JointDesc * desc,
uint32_t joint_axis,
R2Real target_velocity,
R2Real factor )

Set the joint desc motor velocity target and damping factor on an axis.

◆ r2JointDesc_SetSoftness()

R2Status r2JointDesc_SetSoftness ( struct R2JointDesc * desc,
struct R2SpringCoefficients value )

Set the joint desc joint spring coefficients.

◆ r2JointDesc_SetUserData()

R2Status r2JointDesc_SetUserData ( struct R2JointDesc * desc,
struct R2UserData value )

Set the joint desc application-owned 128-bit user value.

◆ r2MultibodyJoint_ApplyDisplacements()

R2Status r2MultibodyJoint_ApplyDisplacements ( struct R2MultibodyJointHandle handle,
const R2Real * displacements,
size_t count )

Apply generalized articulation displacements in native degree-of-freedom order.

◆ r2MultibodyJoint_Bodies()

struct R2JointBodies r2MultibodyJoint_Bodies ( struct R2MultibodyJointHandle handle)

Return the two bodies connected by a multibody joint: its parent link, then its own link.

◆ r2MultibodyJoint_Desc()

struct R2JointDesc r2MultibodyJoint_Desc ( struct R2MultibodyJointHandle handle)

Copies the multibody joint configuration without returning a borrowed joint pointer.

◆ r2MultibodyJoint_GeneralizedVelocity()

size_t r2MultibodyJoint_GeneralizedVelocity ( struct R2MultibodyJointHandle handle,
R2Real * buffer,
size_t capacity )

Copy the articulation generalized velocities in native degree-of-freedom order.

See also
Arrays and output buffers

◆ r2MultibodyJoint_InverseKinematics()

R2Status r2MultibodyJoint_InverseKinematics ( struct R2MultibodyJointHandle handle,
const struct R2InverseKinematicsOptions * options,
struct R2Pose target,
R2IkJointCanMove can_move,
void * user_data,
R2Real * displacements,
size_t count )

Read/write displacement buffer must contain exactly ndofs entries; zero it for a fresh solve.

◆ r2MultibodyJoint_Ndofs()

size_t r2MultibodyJoint_Ndofs ( struct R2MultibodyJointHandle handle)

Return the degrees of freedom of the whole multibody containing the joint (not of the joint alone), including the free root of a dynamic multibody.

After inserting a joint, the root's contribution is only updated by the next step.

◆ r2MultibodyJoint_SetDesc()

R2Status r2MultibodyJoint_SetDesc ( struct R2MultibodyJointHandle handle,
const struct R2JointDesc * desc,
R2Bool wake_up )

Replaces the multibody joint configuration after validation.

lockedAxes defines the degrees of freedom of the multibody and cannot change: a different value reports INVALID_ARGUMENT. wake_up = 1 wakes the two connected bodies; 0 preserves their sleep state.

◆ r2MultibodyJoint_SetGeneralizedVelocity()

R2Status r2MultibodyJoint_SetGeneralizedVelocity ( struct R2MultibodyJointHandle handle,
const R2Real * values,
size_t count )

Replace articulation generalized velocities; the array length must match its degrees of freedom.

◆ r2MultibodyJointCount()

size_t r2MultibodyJointCount ( const struct R2World * world)

Return the number of multibody joints in the world, which is the number of handles copied by r2MultibodyJointHandles.

◆ r2MultibodyJointHandles()

size_t r2MultibodyJointHandles ( const struct R2World * world,
struct R2MultibodyJointHandle * buffer,
size_t capacity )

Copy entity handles.

See also
Arrays and output buffers

◆ r2PinSlotJointDesc()

struct R2JointDesc r2PinSlotJointDesc ( struct R2Vector axis_vector)

Returns a joint description.

Invalid axes produce nonfinite frames, rejected on insertion.

◆ r2PrismaticJointDesc()

struct R2JointDesc r2PrismaticJointDesc ( struct R2Vector axis_vector)

Returns a joint description.

Invalid axes produce nonfinite frames, rejected on insertion.

◆ r2RemoveImpulseJoint()

R2Status r2RemoveImpulseJoint ( struct R2ImpulseJointHandle handle,
R2Bool wake_up )

Remove an impulse joint.

wake_up wakes its connected bodies.

◆ r2RemoveMultibodyJoint()

R2Status r2RemoveMultibodyJoint ( struct R2MultibodyJointHandle handle,
R2Bool wake_up )

Remove an articulation joint.

wake_up wakes affected bodies.

◆ r2RevoluteJointDesc()

struct R2JointDesc r2RevoluteJointDesc ( void )

Return a revolute joint description with native defaults; no allocation.

◆ r2RopeJointDesc()

struct R2JointDesc r2RopeJointDesc ( R2Real length)

Return a rope joint description with native defaults; no allocation.

◆ r2SpringJointDesc()

struct R2JointDesc r2SpringJointDesc ( R2Real length,
R2Real stiffness,
R2Real damping )

Return a spring joint description with native defaults; no allocation.