Class PxRackAndPinionJoint


public class PxRackAndPinionJoint extends PxJoint
A joint that connects an existing revolute joint to an existing prismatic joint, and constrains their relative angular/linear velocity and position with respect to each other.
See Also:
  • Field Details

    • SIZEOF

      public static final int SIZEOF
    • ALIGNOF

      public static final int ALIGNOF
      See Also:
  • Constructor Details

    • PxRackAndPinionJoint

      protected PxRackAndPinionJoint()
    • PxRackAndPinionJoint

      protected PxRackAndPinionJoint(long address)
  • Method Details

    • wrapPointer

      public static PxRackAndPinionJoint wrapPointer(long address)
    • arrayGet

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

      public void destroy()
    • setJoints

      public boolean setJoints(PxBase hinge, PxBase prismatic)
      Set the hinge & prismatic joints connected by the rack & pinion joint.

      The passed hinge joint can be either PxRevoluteJoint, PxD6Joint or PxArticulationJointReducedCoordinate. The passed prismatic joint can be either PxPrismaticJoint or PxD6Joint.

      Note that these joints are only used to compute the positional error correction term, used to adjust potential drift between jointed actors. The rack & pinion joint can run without calling this function, but in that case some visible overlap may develop over time between the teeth of the rack & pinion meshes.

      Note: Calling this function resets the internal positional error correction term.

      Parameters:
      hinge - The hinge joint (pinion)
      prismatic - The prismatic joint (rack)
      Returns:
      true if success
    • setRatio

      public void setRatio(float ratio)
      Set the desired ratio directly.

      Note: You may need to use a negative gear ratio if the joint frames of involved actors are not oriented in the same direction.

      Note: Calling this function resets the internal positional error correction term.

      Parameters:
      ratio - Desired ratio between the hinge and the prismatic.
    • getRatio

      public float getRatio()
      Get the ratio.
      Returns:
      Current ratio
    • setData

      public boolean setData(int nbRackTeeth, int nbPinionTeeth, float rackLength)
      Set the desired ratio indirectly.

      This is a simple helper function that computes the ratio from passed data:

      ratio = (PI*2*nbRackTeeth)/(rackLength*nbPinionTeeth)

      Note: Calling this function resets the internal positional error correction term.

      Parameters:
      nbRackTeeth - Number of teeth on the rack (cannot be zero)
      nbPinionTeeth - Number of teeth on the pinion (cannot be zero)
      rackLength - Length of the rack
      Returns:
      true if success