Class HingeJoint

All Implemented Interfaces:

public class HingeJoint extends PhysicsJoint
From bullet manual:
Hinge constraint, or revolute joint restricts two additional angular degrees of freedom, so the body can only rotate around one axis, the hinge axis. This can be useful to represent doors or wheels rotating around one axis. The user can specify limits and motor for the hinge.
  • Field Details

    • axisA

      protected Vector3f axisA
    • axisB

      protected Vector3f axisB
    • angularOnly

      protected boolean angularOnly
    • biasFactor

      protected float biasFactor
    • relaxationFactor

      protected float relaxationFactor
    • limitSoftness

      protected float limitSoftness
  • Constructor Details

    • HingeJoint

      protected HingeJoint()
    • HingeJoint

      public HingeJoint(PhysicsRigidBody nodeA, PhysicsRigidBody nodeB, Vector3f pivotA, Vector3f pivotB, Vector3f axisA, Vector3f axisB)
      Creates a new HingeJoint
      nodeA - the body for the A end (not null, alias created)
      nodeB - the body for the B end (not null, alias created)
      pivotA - local translation of the joint connection point in node A
      pivotB - local translation of the joint connection point in node B
      axisA - the joint axis in A's local coordinates (unit vector, alias created)
      axisB - the joint axis in B's local coordinates (unit vector, alias created)
  • Method Details

    • enableMotor

      public void enableMotor(boolean enable, float targetVelocity, float maxMotorImpulse)
      Enables the motor.
      enable - if true, motor is enabled.
      targetVelocity - the target velocity of the rotation.
      maxMotorImpulse - the max force applied to the hinge to rotate it.
    • setLimit

      public void setLimit(float low, float high)
      Sets the limits of this joint.
      low - the low limit in radians.
      high - the high limit in radians.
    • setLimit

      public void setLimit(float low, float high, float _softness, float _biasFactor, float _relaxationFactor)
      Sets the limits of this joint. If you're above the softness, velocities that would shoot through the actual limit are slowed down. The bias be in the range of 0.2 - 0.5.
      low - the low limit in radians.
      high - the high limit in radians.
      _softness - the factor at which the velocity error correction starts operating,i.e a softness of 0.9 means that the vel. corr starts at 90% of the limit range.
      _biasFactor - the magnitude of the position correction. It tells you how strictly the position error (drift ) is corrected.
      _relaxationFactor - the rate at which velocity errors are corrected. This can be seen as the strength of the limits. A low value will make the limits more spongy.
    • getUpperLimit

      public float getUpperLimit()
    • getLowerLimit

      public float getLowerLimit()
    • setAngularOnly

      public void setAngularOnly(boolean angularOnly)
    • getHingeAngle

      public float getHingeAngle()
    • write

      public void write(JmeExporter ex) throws IOException
      Specified by:
      write in interface Savable
      write in class PhysicsJoint
    • read

      public void read(JmeImporter im) throws IOException
      Specified by:
      read in interface Savable
      read in class PhysicsJoint
    • createJoint

      protected void createJoint()