Class TranslationalLimitMotor

java.lang.Object
com.jme3.bullet.NativePhysicsObject
com.jme3.bullet.joints.motors.TranslationalLimitMotor
All Implemented Interfaces:
Comparable<NativePhysicsObject>

public class TranslationalLimitMotor extends NativePhysicsObject
A motor based on Bullet's btTranslationalLimitMotor, used to control the translation of a SixDofJoint.
  • Field Details

    • logger

      public static final Logger logger
      message logger for this class
  • Constructor Details

    • TranslationalLimitMotor

      public TranslationalLimitMotor(long nativeId)
      Instantiate a motor. Used internally.
      Parameters:
      nativeId - the ID of the pre-existing btTranslationalLimitMotor (not zero)
  • Method Details

    • getAccumulatedImpulse

      public Vector3f getAccumulatedImpulse(Vector3f storeResult)
      Copy the accumulated impulse (native field: m_accumulatedImpulse).
      Parameters:
      storeResult - storage for the result (modified if not null)
      Returns:
      a new vector (not null)
    • getDamping

      public float getDamping()
      Return this motor's damping (native field: m_damping).
      Returns:
      the viscous damping ratio (0→no damping, 1→critically damped)
    • getERP

      public Vector3f getERP(Vector3f storeResult)
      Copy this motor's error-reduction parameters at the limits (native field: m_stopERP).
      Parameters:
      storeResult - storage for the result (modified if not null)
      Returns:
      the error-reduction parameter for each axis (either storeResult or a new instance, not null)
    • getLimitSoftness

      public float getLimitSoftness()
      Return this motor's limit softness (native field: m_limitSoftness).
      Returns:
      the limit softness (or relaxation factor)
    • getLowerLimit

      public Vector3f getLowerLimit(Vector3f storeResult)
      Copy this motor's constraint lower limits (native field: m_lowerLimit).
      Parameters:
      storeResult - storage for the result (modified if not null)
      Returns:
      the lower limit for each axis (either storeResult or a new instance)
    • getMaxMotorForce

      public Vector3f getMaxMotorForce(Vector3f storeResult)
      Copy this motor's maximum motor forces for normal conditions (native field: m_maxMotorForce).
      Parameters:
      storeResult - storage for the result (modified if not null)
      Returns:
      the maximum force for each axis (either storeResult or a new instance)
    • getNormalCFM

      public Vector3f getNormalCFM(Vector3f storeResult)
      Copy this motor's constraint-force mixing parameters for normal conditions (native field: m_normalCFM).
      Parameters:
      storeResult - storage for the result (modified if not null)
      Returns:
      the mixing parameter for each axis (either storeResult or a new instance)
    • getOffset

      public Vector3f getOffset(Vector3f storeResult)
      Return the offset of the constraint frames (native field: m_currentLinearDiff).
      Parameters:
      storeResult - storage for the result (modified if not null)
      Returns:
      the offset (either storeResult or a new instance)
    • getRestitution

      public float getRestitution()
      Return this motor's restitution at the limits (native field: m_restitution).
      Returns:
      the restitution (bounce) factor
    • getStopCFM

      public Vector3f getStopCFM(Vector3f storeResult)
      Copy this motor's constraint-force mixing parameters at the limits (native field: m_stopCFM).
      Parameters:
      storeResult - storage for the result (modified if not null)
      Returns:
      the mixing parameter for each axis (either storeResult or a new instance)
    • getTargetVelocity

      public Vector3f getTargetVelocity(Vector3f storeResult)
      Copy this motor's target velocity (native field: m_targetVelocity).
      Parameters:
      storeResult - storage for the result (modified if not null)
      Returns:
      the target velocity vector (either storeResult or a new instance)
    • getUpperLimit

      public Vector3f getUpperLimit(Vector3f storeResult)
      Copy this motor's constraint upper limits (native field: m_upperLimit).
      Parameters:
      storeResult - storage for the result (modified if not null)
      Returns:
      the upper limit for each axis (either storeResult or a new instance)
    • isEnabled

      public boolean isEnabled(int axisIndex)
      Test whether the indexed axis is enabled (native field: m_enableMotor).
      Parameters:
      axisIndex - which axis: 0→X, 1→Y, 2→Z
      Returns:
      true if enabled, otherwise false
    • setAccumulatedImpulse

      public void setAccumulatedImpulse(Vector3f accumulatedImpulse)
      Alter the accumulated impulse (native field: m_accumulatedImpulse).
      Parameters:
      accumulatedImpulse - the desired vector (not null, unaffected, default=(0,0,0))
    • setDamping

      public void setDamping(float damping)
      Alter this motor's damping (native field: m_damping).
      Parameters:
      damping - the desired viscous damping ratio (0→no damping, 1→critically damped, default=1)
    • setEnabled

      public void setEnabled(int axisIndex, boolean enableMotor)
      Enable or disable the indexed axis (native field: m_enableMotor).
      Parameters:
      axisIndex - which axis: 0→X, 1→Y, 2→Z
      enableMotor - true→enable, false→disable (default=false)
    • setERP

      public void setERP(Vector3f erp)
      Alter this motor's error-reduction parameters at the limits (native field: m_stopERP).
      Parameters:
      erp - the desired error-reduction parameter parameter for each axis (not null, unaffected, default=(0.2,0.2,0.2))
    • setLimitSoftness

      public void setLimitSoftness(float limitSoftness)
      Alter the limit softness (native field: m_limitSoftness).
      Parameters:
      limitSoftness - the desired limit softness (default=0.7)
    • setLowerLimit

      public void setLowerLimit(Vector3f lowerLimit)
      Alter this motor's constraint lower limits (native field: m_lowerLimit).
      Parameters:
      lowerLimit - the desired limit value for each axis (unaffected, not null, default=(0,0,0))
    • setMaxMotorForce

      public void setMaxMotorForce(Vector3f maxForce)
      Alter this motor's maximum forces (native field: m_maxMotorForce).
      Parameters:
      maxForce - the desired maximum force for each axis (not null, unaffected, default=(0,0,0))
    • setNormalCFM

      public void setNormalCFM(Vector3f cfm)
      Alter this motor's constraint-force mixing parameters for normal conditions (native field: m_normalCFM).
      Parameters:
      cfm - the desired mixing parameter for each axis (not null, unaffected, default=(0,0,0))
    • setRestitution

      public void setRestitution(float restitution)
      Alter this motor's restitution at the limits (native field: m_restitution).
      Parameters:
      restitution - the desired restitution (bounce) factor (default=0.5)
    • setStopCFM

      public void setStopCFM(Vector3f cfm)
      Alter this motor's constraint-force mixing parameters at the limits (native field: m_stopCFM).
      Parameters:
      cfm - the desired mixing parameter for each axis (not null, unaffected, default=(0,0,0))
    • setTargetVelocity

      public void setTargetVelocity(Vector3f velocity)
      Alter this motor's target velocity (native field: m_targetVelocity).
      Parameters:
      velocity - the desired velocity vector (not null, unaffected, default=(0,0,0))
    • setUpperLimit

      public void setUpperLimit(Vector3f upperLimit)
      Alter this motor's constraint upper limits (native field: m_upperLimit).
      Parameters:
      upperLimit - the desired limit value for each axis (unaffected, not null, default=(0,0,0))