Class SliderJoint

All Implemented Interfaces:
com.jme3.export.Savable, com.jme3.util.clone.JmeCloneable, Cloneable, Comparable<NativePhysicsObject>

public class SliderJoint extends Constraint
A 2 degree-of-freedom joint based on Bullet's btSliderConstraint. The axis of the joint always parallels the physics-space X axis.

From the Bullet manual:
The slider constraint allows the body to rotate around one axis and translate along this axis.

  • Field Details

    • logger2

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

    • SliderJoint

      protected SliderJoint()
      No-argument constructor needed by SavableClassUtil.
    • SliderJoint

      public SliderJoint(PhysicsRigidBody rigidBodyB, com.jme3.math.Vector3f pivotInB, com.jme3.math.Vector3f pivotInWorld, JointEnd linearReferenceFrame)
      Instantiate a single-ended SliderJoint.

      To be effective, the joint must be added to the body's PhysicsSpace and the body must be dynamic.

      Parameters:
      rigidBodyB - the body to constrain (not null, alias created)
      pivotInB - the pivot location in B's scaled local coordinates (not null, unaffected)
      pivotInWorld - the pivot location in physics-space coordinates (not null, unaffected)
      linearReferenceFrame - which end to use as the linear reference (not null)
    • SliderJoint

      public SliderJoint(PhysicsRigidBody rigidBodyA, PhysicsRigidBody rigidBodyB, com.jme3.math.Vector3f pivotInA, com.jme3.math.Vector3f pivotInB, com.jme3.math.Matrix3f rotInA, com.jme3.math.Matrix3f rotInB, boolean useLinearReferenceFrameA)
      Instantiate a double-ended SliderJoint.

      To be effective, the joint must be added to the PhysicsSpace of both bodies. Also, the bodies must be distinct and at least one of them must be dynamic.

      Parameters:
      rigidBodyA - the body for the A end (not null, alias created)
      rigidBodyB - the body for the B end (not null, alias created)
      pivotInA - the pivot location in A's scaled local coordinates (not null, unaffected)
      pivotInB - the pivot location in B's scaled local coordinates (not null, unaffected)
      rotInA - the joint orientation in A's local coordinates (not null, alias unaffected)
      rotInB - the joint orientation in B's local coordinates (not null, alias unaffected)
      useLinearReferenceFrameA - true→use body A, false→use body B
    • SliderJoint

      public SliderJoint(PhysicsRigidBody rigidBodyA, PhysicsRigidBody rigidBodyB, com.jme3.math.Vector3f pivotInA, com.jme3.math.Vector3f pivotInB, boolean useLinearReferenceFrameA)
      Instantiate a double-ended SliderJoint.

      To be effective, the joint must be added to the body's PhysicsSpace and the body must be dynamic.

      Parameters:
      rigidBodyA - the first body to constrain (not null, alias created)
      rigidBodyB - the 2nd body to constrain (not null, alias created)
      pivotInA - the pivot location in A's scaled local coordinates (not null, unaffected)
      pivotInB - the pivot location in B's scaled local coordinates (not null, unaffected)
      useLinearReferenceFrameA - true→use body A, false→use body B
  • Method Details

    • getDampingDirAng

      public float getDampingDirAng()
      Read the joint's damping for on-axis rotation between the limits.
      Returns:
      the viscous damping ratio (0→no damping, 1→critically damped)
    • getDampingDirLin

      public float getDampingDirLin()
      Read the joint's damping for on-axis translation between the limits.
      Returns:
      the viscous damping ratio (0→no damping, 1→critically damped)
    • getDampingLimAng

      public float getDampingLimAng()
      Read the joint's damping for on-axis rotation hitting the limits.
      Returns:
      the viscous damping ratio (0→no damping, 1→critically damped)
    • getDampingLimLin

      public float getDampingLimLin()
      Read the joint's damping for on-axis translation hitting the limits.
      Returns:
      the viscous damping ratio (0→no damping, 1→critically damped)
    • getDampingOrthoAng

      public float getDampingOrthoAng()
      Read the joint's damping for off-axis rotation.
      Returns:
      the viscous damping ratio (0→no damping, 1→critically damped)
    • getDampingOrthoLin

      public float getDampingOrthoLin()
      Read the joint's damping for off-axis translation.
      Returns:
      the viscous damping ratio (0→no damping, 1→critically damped)
    • getFrameTransform

      public com.jme3.math.Transform getFrameTransform(JointEnd end, com.jme3.math.Transform storeResult)
      Copy the joint's frame transform relative to the specified end.
      Parameters:
      end - which end (not null)
      storeResult - storage for the result (modified if not null)
      Returns:
      the transform of the constraint space relative to the end
    • getLowerAngLimit

      public float getLowerAngLimit()
      Read the joint's lower limit for on-axis rotation.
      Returns:
      the lower limit angle (in radians)
    • getLowerLinLimit

      public float getLowerLinLimit()
      Read the joint's lower limit for on-axis translation.
      Returns:
      the lower limit
    • getMaxAngMotorForce

      public float getMaxAngMotorForce()
      Read the maximum force of the rotation motor.
      Returns:
      the maximum force
    • getMaxLinMotorForce

      public float getMaxLinMotorForce()
      Read the maximum force of the translation motor.
      Returns:
      the maximum force
    • getRestitutionDirAng

      public float getRestitutionDirAng()
      Read the joint's restitution for on-axis rotation between the limits.
      Returns:
      the restitution (bounce) factor
    • getRestitutionDirLin

      public float getRestitutionDirLin()
      Read the joint's restitution for on-axis translation between the limits.
      Returns:
      the restitution (bounce) factor
    • getRestitutionLimAng

      public float getRestitutionLimAng()
      Read the joint's restitution for on-axis rotation hitting the limits.
      Returns:
      the restitution (bounce) factor
    • getRestitutionLimLin

      public float getRestitutionLimLin()
      Read the joint's restitution for on-axis translation hitting the limits.
      Returns:
      the restitution (bounce) factor
    • getRestitutionOrthoAng

      public float getRestitutionOrthoAng()
      Read the joint's restitution for off-axis rotation.
      Returns:
      the restitution (bounce) factor
    • getRestitutionOrthoLin

      public float getRestitutionOrthoLin()
      Read the joint's restitution for off-axis translation.
      Returns:
      the restitution (bounce) factor
    • getSoftnessDirAng

      public float getSoftnessDirAng()
      Read the joint's softness for on-axis rotation between the limits.
      Returns:
      the softness
    • getSoftnessDirLin

      public float getSoftnessDirLin()
      Read the joint's softness for on-axis translation between the limits.
      Returns:
      the softness
    • getSoftnessLimAng

      public float getSoftnessLimAng()
      Read the joint's softness for on-axis rotation hitting the limits.
      Returns:
      the softness
    • getSoftnessLimLin

      public float getSoftnessLimLin()
      Read the joint's softness for on-axis translation hitting the limits.
      Returns:
      the softness
    • getSoftnessOrthoAng

      public float getSoftnessOrthoAng()
      Read the joint's softness for off-axis rotation.
      Returns:
      the softness
    • getSoftnessOrthoLin

      public float getSoftnessOrthoLin()
      Read the joint's softness for off-axis translation.
      Returns:
      the softness
    • getTargetAngMotorVelocity

      public float getTargetAngMotorVelocity()
      Read the velocity target of the rotation motor.
      Returns:
      the velocity target (in radians per second)
    • getTargetLinMotorVelocity

      public float getTargetLinMotorVelocity()
      Read the velocity target of the translation motor.
      Returns:
      the velocity target
    • getUpperAngLimit

      public float getUpperAngLimit()
      Read the joint's upper limit for on-axis rotation.
      Returns:
      the upper limit angle (in radians)
    • getUpperLinLimit

      public float getUpperLinLimit()
      Read the joint's upper limit for on-axis translation.
      Returns:
      the upper limit
    • isPoweredAngMotor

      public boolean isPoweredAngMotor()
      Test whether the rotation motor is powered.
      Returns:
      true if powered, otherwise false
    • isPoweredLinMotor

      public boolean isPoweredLinMotor()
      Test whether the translation motor is powered.
      Returns:
      true if powered, otherwise false
    • setDampingDirAng

      public void setDampingDirAng(float dampingDirAng)
      Alter the joint's damping for on-axis rotation between the limits.
      Parameters:
      dampingDirAng - the desired viscous damping ratio (0→no damping, 1→critically damped, default=0)
    • setDampingDirLin

      public void setDampingDirLin(float dampingDirLin)
      Alter the joint's damping for on-axis translation between the limits.
      Parameters:
      dampingDirLin - the desired viscous damping ratio (0→no damping, 1→critically damped, default=0)
    • setDampingLimAng

      public void setDampingLimAng(float dampingLimAng)
      Alter the joint's damping for on-axis rotation hitting the limits.
      Parameters:
      dampingLimAng - the desired viscous damping ratio (0→no damping, 1→critically damped, default=1)
    • setDampingLimLin

      public void setDampingLimLin(float dampingLimLin)
      Alter the joint's damping for on-axis translation hitting the limits.
      Parameters:
      dampingLimLin - the desired viscous damping ratio (0→no damping, 1→critically damped, default=1)
    • setDampingOrthoAng

      public void setDampingOrthoAng(float dampingOrthoAng)
      Alter the joint's damping for off-axis rotation.
      Parameters:
      dampingOrthoAng - the desired viscous damping ratio (0→no damping, 1→critically damped, default=1)
    • setDampingOrthoLin

      public void setDampingOrthoLin(float dampingOrthoLin)
      Alter the joint's damping for off-axis translation.
      Parameters:
      dampingOrthoLin - the desired viscous damping ratio (0→no damping, 1→critically damped, default=1)
    • setLowerAngLimit

      public void setLowerAngLimit(float lowerAngLimit)
      Alter the joint's lower limit for on-axis rotation.
      Parameters:
      lowerAngLimit - the desired lower limit angle (in radians, default=0)
    • setLowerLinLimit

      public void setLowerLinLimit(float lowerLinLimit)
      Alter the joint's lower limit for on-axis translation.
      Parameters:
      lowerLinLimit - the desired lower limit (default=1)
    • setMaxAngMotorForce

      public void setMaxAngMotorForce(float maxAngMotorForce)
      Alter the maximum force of the rotation motor.
      Parameters:
      maxAngMotorForce - the desired maximum force (default=0)
    • setMaxLinMotorForce

      public void setMaxLinMotorForce(float maxLinMotorForce)
      Alter the maximum force of the translation motor.
      Parameters:
      maxLinMotorForce - the desired maximum force (default=0)
    • setPoweredAngMotor

      public void setPoweredAngMotor(boolean poweredAngMotor)
      Alter whether the rotation motor is powered.
      Parameters:
      poweredAngMotor - true to power the motor, false to de-power it (default=false)
    • setPoweredLinMotor

      public void setPoweredLinMotor(boolean poweredLinMotor)
      Alter whether the translation motor is powered.
      Parameters:
      poweredLinMotor - true to power the motor, false to de-power it (default=false)
    • setRestitutionDirAng

      public void setRestitutionDirAng(float restitutionDirAng)
      Alter the joint's restitution for on-axis rotation between the limits.
      Parameters:
      restitutionDirAng - the desired restitution (bounce) factor (default=0.7)
    • setRestitutionDirLin

      public void setRestitutionDirLin(float restitutionDirLin)
      Alter the joint's restitution for on-axis translation between the limits.
      Parameters:
      restitutionDirLin - the desired restitution (bounce) factor (default=0.7)
    • setRestitutionLimAng

      public void setRestitutionLimAng(float restitutionLimAng)
      Alter the joint's restitution for on-axis rotation hitting the limits.
      Parameters:
      restitutionLimAng - the desired restitution (bounce) factor (default=0.7)
    • setRestitutionLimLin

      public void setRestitutionLimLin(float restitutionLimLin)
      Alter the joint's restitution for on-axis translation hitting the limits.
      Parameters:
      restitutionLimLin - the desired restitution (bounce) factor (default=0.7)
    • setRestitutionOrthoAng

      public void setRestitutionOrthoAng(float restitutionOrthoAng)
      Alter the joint's restitution for off-axis rotation.
      Parameters:
      restitutionOrthoAng - the desired restitution (bounce) factor (default=0.7)
    • setRestitutionOrthoLin

      public void setRestitutionOrthoLin(float restitutionOrthoLin)
      Alter the joint's restitution for off-axis translation.
      Parameters:
      restitutionOrthoLin - the desired restitution (bounce) factor (default=0.7)
    • setSoftnessDirAng

      public void setSoftnessDirAng(float softnessDirAng)
      Alter the joint's softness for on-axis rotation between the limits.
      Parameters:
      softnessDirAng - the desired softness (default=1)
    • setSoftnessDirLin

      public void setSoftnessDirLin(float softnessDirLin)
      Alter the joint's softness for on-axis translation between the limits.
      Parameters:
      softnessDirLin - the desired softness (default=1)
    • setSoftnessLimAng

      public void setSoftnessLimAng(float softnessLimAng)
      Alter the joint's softness for on-axis rotation hitting the limits.
      Parameters:
      softnessLimAng - the desired softness (default=1)
    • setSoftnessLimLin

      public void setSoftnessLimLin(float softnessLimLin)
      Alter the joint's softness for on-axis translation hitting the limits.
      Parameters:
      softnessLimLin - the desired softness (default=1)
    • setSoftnessOrthoAng

      public void setSoftnessOrthoAng(float softnessOrthoAng)
      Alter the joint's softness for off-axis rotation.
      Parameters:
      softnessOrthoAng - the desired softness (default=1)
    • setSoftnessOrthoLin

      public void setSoftnessOrthoLin(float softnessOrthoLin)
      Alter the joint's softness for off-axis translation.
      Parameters:
      softnessOrthoLin - the desired softness (default=1)
    • setTargetAngMotorVelocity

      public void setTargetAngMotorVelocity(float targetAngMotorVelocity)
      Alter the velocity target of the rotation motor.
      Parameters:
      targetAngMotorVelocity - the desired velocity target (in radians per second, default=0)
    • setTargetLinMotorVelocity

      public void setTargetLinMotorVelocity(float targetLinMotorVelocity)
      Alter the velocity target of the translation motor.
      Parameters:
      targetLinMotorVelocity - the desired velocity target (default=0)
    • setUpperAngLimit

      public void setUpperAngLimit(float upperAngLimit)
      Alter the joint's upper limit for on-axis rotation.
      Parameters:
      upperAngLimit - the desired upper limit angle (in radians, default=0)
    • setUpperLinLimit

      public void setUpperLinLimit(float upperLinLimit)
      Alter the joint's upper limit for on-axis translation.
      Parameters:
      upperLinLimit - the desired upper limit (default=-1)
    • cloneFields

      public void cloneFields(com.jme3.util.clone.Cloner cloner, Object original)
      Callback from Cloner to convert this shallow-cloned joint into a deep-cloned one, using the specified Cloner and original to resolve copied fields.
      Specified by:
      cloneFields in interface com.jme3.util.clone.JmeCloneable
      Overrides:
      cloneFields in class Constraint
      Parameters:
      cloner - the Cloner that's cloning this joint (not null)
      original - the instance from which this joint was shallow-cloned (not null, unaffected)
    • read

      public void read(com.jme3.export.JmeImporter importer) throws IOException
      De-serialize this joint from the specified importer, for example when loading from a J3O file.
      Specified by:
      read in interface com.jme3.export.Savable
      Overrides:
      read in class Constraint
      Parameters:
      importer - (not null)
      Throws:
      IOException - from the importer
    • write

      public void write(com.jme3.export.JmeExporter exporter) throws IOException
      Serialize this joint to the specified exporter, for example when saving to a J3O file.
      Specified by:
      write in interface com.jme3.export.Savable
      Overrides:
      write in class Constraint
      Parameters:
      exporter - (not null)
      Throws:
      IOException - from the exporter