Class PxRevoluteJoint


public class PxRevoluteJoint extends PxJoint
A joint which behaves in a similar way to a hinge or axle.

A hinge joint removes all but a single rotational degree of freedom from two objects. The axis along which the two bodies may rotate is specified with a point and a direction vector.

The position of the hinge on each body is specified by the origin of the body's joint frame. The axis of the hinge is specified as the direction of the x-axis in the body's joint frame.

\image html revoluteJoint.png

A revolute joint can be given a motor, so that it can apply a force to rotate the attached actors. It may also be given a limit, to restrict the revolute motion to within a certain range. In addition, the bodies may be projected together if the distance or angle between them exceeds a given threshold.

Projection, drive and limits are activated by setting the appropriate flags on the joint.

See Also:
  • Field Details

    • SIZEOF

      public static final int SIZEOF
    • ALIGNOF

      public static final int ALIGNOF
      See Also:
  • Constructor Details

    • PxRevoluteJoint

      protected PxRevoluteJoint()
    • PxRevoluteJoint

      protected PxRevoluteJoint(long address)
  • Method Details

    • wrapPointer

      public static PxRevoluteJoint wrapPointer(long address)
    • arrayGet

      public static PxRevoluteJoint arrayGet(long baseAddress, int index)
    • destroy

      public void destroy()
    • getAngle

      public float getAngle()
      return the angle of the joint, in the range (-2*Pi, 2*Pi]
    • getVelocity

      public float getVelocity()
      return the velocity of the joint
    • setLimit

      public void setLimit(PxJointAngularLimitPair limits)
      set the joint limit parameters.

      The limit is activated using the flag PxRevoluteJointFlag::eLIMIT_ENABLED

      The limit angle range is (-2*Pi, 2*Pi).

      Parameters:
      limits - The joint limit parameters.
      See Also:
    • setDriveVelocity

      public void setDriveVelocity(float velocity)
      set the target velocity for the drive model.

      The motor will only be able to reach this velocity if the maxForce is sufficiently large. If the joint is spinning faster than this velocity, the motor will actually try to brake (see PxRevoluteJointFlag::eDRIVE_FREESPIN.)

      The sign of this variable determines the rotation direction, with positive values going the same way as positive joint angles. Setting a very large target velocity may cause undesirable results.

      Parameters:
      velocity - the drive target velocity

      Range: (-PX_MAX_F32, PX_MAX_F32)
      Default: 0.0

    • setDriveVelocity

      public void setDriveVelocity(float velocity, boolean autowake)
      set the target velocity for the drive model.

      The motor will only be able to reach this velocity if the maxForce is sufficiently large. If the joint is spinning faster than this velocity, the motor will actually try to brake (see PxRevoluteJointFlag::eDRIVE_FREESPIN.)

      The sign of this variable determines the rotation direction, with positive values going the same way as positive joint angles. Setting a very large target velocity may cause undesirable results.

      Parameters:
      velocity - the drive target velocity
      autowake - Whether to wake up the joint rigids if they are asleep.

      Range: (-PX_MAX_F32, PX_MAX_F32)
      Default: 0.0

    • getDriveVelocity

      public float getDriveVelocity()
      gets the target velocity for the drive model.
      Returns:
      the drive target velocity
      See Also:
    • setDriveForceLimit

      public void setDriveForceLimit(float limit)
      sets the maximum torque the drive can exert.

      The value set here may be used either as an impulse limit or a force limit, depending on the flag PxConstraintFlag::eDRIVE_LIMITS_ARE_FORCES

      Range: [0, PX_MAX_F32)
      Default: PX_MAX_F32

      See Also:
    • getDriveForceLimit

      public float getDriveForceLimit()
      gets the maximum torque the drive can exert.
      Returns:
      the torque limit
      See Also:
    • setDriveGearRatio

      public void setDriveGearRatio(float ratio)
      sets the gear ratio for the drive.

      When setting up the drive constraint, the velocity of the first actor is scaled by this value, and its response to drive torque is scaled down. So if the drive target velocity is zero, the second actor will be driven to the velocity of the first scaled by the gear ratio

      Range: [0, PX_MAX_F32)
      Default: 1.0

      Parameters:
      ratio - the drive gear ratio
      See Also:
    • getDriveGearRatio

      public float getDriveGearRatio()
      gets the gear ratio.
      Returns:
      the drive gear ratio
      See Also:
    • setRevoluteJointFlags

      public void setRevoluteJointFlags(PxRevoluteJointFlags flags)
      sets the flags specific to the Revolute Joint.

      Default PxRevoluteJointFlags(0)

      Parameters:
      flags - The joint flags.
    • setRevoluteJointFlag

      public void setRevoluteJointFlag(PxRevoluteJointFlagEnum flag, boolean value)
      sets a single flag specific to a Revolute Joint.
      Parameters:
      flag - The flag to set or clear.
      value - the value to which to set the flag
    • getRevoluteJointFlags

      public PxRevoluteJointFlags getRevoluteJointFlags()
      gets the flags specific to the Revolute Joint.
      Returns:
      the joint flags