Class PathConstraint

All Implemented Interfaces:
ConstConstraint, ConstJoltPhysicsObject, ConstTwoBodyConstraint, RefTarget, AutoCloseable, Comparable<JoltPhysicsObject>

public class PathConstraint extends TwoBodyConstraint
A TwoBodyConstraint that constrains motion to a path.
  • Method Details

    • getMaxFrictionForce

      public float getMaxFrictionForce()
      Return the maximum friction force when not driven by a motor. The constraint is unaffected.
      Returns:
      the force (in Newtons)
    • getPath

      public PathConstraintPath getPath()
      Access the path.
      Returns:
      a new JVM object with the pre-existing native object assigned
    • getPathFraction

      public float getPathFraction()
      Return how far the body is along the path. The constraint is unaffected.
      Returns:
      the amount
    • getPositionMotorSettings

      public MotorSettings getPositionMotorSettings()
      Access the settings of the position motor.
      Returns:
      a new JVM object with the pre-existing native object assigned
    • getPositionMotorState

      public EMotorState getPositionMotorState()
      Return the state of the position motor. The constraint is unaffected.
      Returns:
      an enum value (not null)
    • getTargetPathFraction

      public float getTargetPathFraction()
      Return how far the body is along the path. The constraint is unaffected.
      Returns:
      the amount (≥0)
    • getTargetVelocity

      public float getTargetVelocity()
      Return the target speed. The constraint is unaffected.
      Returns:
      the target speed (in meters per second)
    • getTotalLambdaMotor

      public float getTotalLambdaMotor()
      Return the total lambda of the motor. The constraint is unaffected.
      Returns:
      the total lambda
    • getTotalLambdaPositionLimits

      public float getTotalLambdaPositionLimits()
      Return the total lambda of the limits. The constraint is unaffected.
      Returns:
      the total lambda
    • getTotalLambdaRotation

      public Vec3 getTotalLambdaRotation()
      Copy the total lambda of rotation. The constraint is unaffected.
      Returns:
      a new vector
    • setMaxFrictionForce

      public void setMaxFrictionForce(float force)
      Alter the maximum friction force when not driven by a motor.
      Parameters:
      force - the desired force (in Newtons)
    • setPath

      public void setPath(PathConstraintPath path, float amount)
      Replace the path.
      Parameters:
      path - the desired path (not null)
      amount - how far the body is along the new path
    • setPositionMotorState

      public void setPositionMotorState(EMotorState state)
      Alter the state of the position motor.
      Parameters:
      state - the desired state (not null)
    • setTargetPathFraction

      public void setTargetPathFraction(float amount)
      Alter how far the body is along the path.
      Parameters:
      amount - the desired amount (≥0)
    • setTargetVelocity

      public void setTargetVelocity(float speed)
      Alter the target speed.
      Parameters:
      speed - the desired speed