java.lang.Object
com.github.stephengold.joltjni.JoltPhysicsObject
com.github.stephengold.joltjni.NonCopyable
com.github.stephengold.joltjni.Constraint
com.github.stephengold.joltjni.TwoBodyConstraint
com.github.stephengold.joltjni.SliderConstraint
- All Implemented Interfaces:
ConstConstraint
,ConstJoltPhysicsObject
,ConstTwoBodyConstraint
,RefTarget
,AutoCloseable
,Comparable<JoltPhysicsObject>
A
TwoBodyConstraint
that allows translation only along one axis and
disables rotation, eliminating 5 degrees of freedom.-
Method Summary
Modifier and TypeMethodDescriptionfloat
Return the current offset from rest position.float
Return the upper limit of translation.float
Return the lower limit of translation.Access the spring settings.float
Return the maximum friction force when not driven by a motor.Access the motor settings.Return the state of the motor.float
Return the target position of the motor.float
Return the target velocity of the motor.boolean
Test whether the constraint has limits.void
setLimits
(float min, float max) Alter the limits.void
setMaxFrictionForce
(float force) Alter the maximum friction force when not driven by a motor.void
setMotorState
(EMotorState state) Alter the state of the motor.void
setTargetPosition
(float offset) Alter the target position of the motor.void
setTargetVelocity
(float velocity) Alter the target velocity of the motor.Methods inherited from class com.github.stephengold.joltjni.TwoBodyConstraint
getBody1, getBody2, getConstraintToBody1Matrix, getConstraintToBody2Matrix, toRef
Methods inherited from class com.github.stephengold.joltjni.Constraint
getConstraintPriority, getConstraintSettings, getEnabled, getNumPositionStepsOverride, getNumVelocityStepsOverride, getRefCount, getSubType, getType, notifyShapeChanged, setConstraintPriority, setEmbedded, setEnabled, setNumPositionStepsOverride, setNumVelocityStepsOverride
Methods inherited from class com.github.stephengold.joltjni.JoltPhysicsObject
close, compareTo, equals, getContainingObject, hasAssignedNativeObject, hashCode, ownsNativeObject, setVirtualAddress, setVirtualAddress, startCleaner, targetVa, toString, va
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.lang.Comparable
compareTo
Methods inherited from interface com.github.stephengold.joltjni.readonly.ConstConstraint
getConstraintPriority, getConstraintSettings, getEnabled, getNumPositionStepsOverride, getNumVelocityStepsOverride, getSubType, getType
Methods inherited from interface com.github.stephengold.joltjni.readonly.ConstJoltPhysicsObject
close, hasAssignedNativeObject, ownsNativeObject, targetVa
-
Method Details
-
getCurrentPosition
public float getCurrentPosition()Return the current offset from rest position. The constraint is unaffected.- Returns:
- the offset (in meters)
-
getLimitsMax
public float getLimitsMax()Return the upper limit of translation. The constraint is unaffected.- Returns:
- the upper limit (in meters)
-
getLimitsMin
public float getLimitsMin()Return the lower limit of translation. The constraint is unaffected.- Returns:
- the lower limit (in meters)
-
getLimitsSpringSettings
Access the spring settings.- Returns:
- a new JVM object with the pre-existing native object assigned
-
getMaxFrictionForce
public float getMaxFrictionForce()Return the maximum friction force when not driven by a motor. The constraint is unaffected.- Returns:
- the force (in Newtons)
-
getMotorSettings
Access the motor settings.- Returns:
- a new JVM object with the pre-existing native object assigned
-
getMotorState
Return the state of the motor. The constraint is unaffected.- Returns:
- an enum value (not null)
-
getTargetPosition
public float getTargetPosition()Return the target position of the motor. The constraint is unaffected.- Returns:
- the linear offset (in meters)
-
getTargetVelocity
public float getTargetVelocity()Return the target velocity of the motor. The constraint is unaffected.- Returns:
- the velocity (in meters per second)
-
hasLimits
public boolean hasLimits()Test whether the constraint has limits. The constraint is unaffected.- Returns:
true
if limited, otherwisefalse
-
setLimits
public void setLimits(float min, float max) Alter the limits.- Parameters:
min
- the desired lower limit (in meters)max
- the desired upper limit (in meters)
-
setMaxFrictionForce
public void setMaxFrictionForce(float force) Alter the maximum friction force when not driven by a motor.- Parameters:
force
- the desired force (in Newtons)
-
setMotorState
Alter the state of the motor.- Parameters:
state
- the desired state (not null)
-
setTargetPosition
public void setTargetPosition(float offset) Alter the target position of the motor.- Parameters:
offset
- the desired linear offset (in meters)
-
setTargetVelocity
public void setTargetVelocity(float velocity) Alter the target velocity of the motor.- Parameters:
velocity
- the desired linear velocity (in meters per second)
-