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.HingeConstraint
- All Implemented Interfaces:
ConstConstraint
,ConstJoltPhysicsObject
,ConstTwoBodyConstraint
,RefTarget
,AutoCloseable
,Comparable<JoltPhysicsObject>
A
TwoBodyConstraint
that allows rotation only along one axis and
disables translation, eliminating 5 degrees of freedom.-
Method Summary
Modifier and TypeMethodDescriptionfloat
Return the current angle from rest orientation.float
Return the upper limit of rotation.float
Return the lower limit of rotation.Access the spring settings.float
Return the maximum friction torque when not driven by a motor.Access the motor settings.Return the state of the motor.float
Return the target angle of the motor.float
Return the target angular velocity of the motor.boolean
Test whether the constraint has limits.void
setLimits
(float min, float max) Alter the limits.void
setMaxFrictionTorque
(float torque) Alter the maximum friction torque when not driven by a motor.void
setMotorState
(EMotorState state) Alter the state of the motor.void
setTargetAngle
(float angle) Alter the target angle of the motor.void
setTargetAngularVelocity
(float omega) Alter the target angular 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
-
getCurrentAngle
public float getCurrentAngle()Return the current angle from rest orientation. The constraint is unaffected.- Returns:
- the angle (in radians)
-
getLimitsMax
public float getLimitsMax()Return the upper limit of rotation. The constraint is unaffected.- Returns:
- the upper limit (in radians)
-
getLimitsMin
public float getLimitsMin()Return the lower limit of rotation. The constraint is unaffected.- Returns:
- the lower limit (in radians)
-
getLimitsSpringSettings
Access the spring settings.- Returns:
- a new JVM object with the pre-existing native object assigned
-
getMaxFrictionTorque
public float getMaxFrictionTorque()Return the maximum friction torque when not driven by a motor. The constraint is unaffected.- Returns:
- the torque (in Newton.meters)
-
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)
-
getTargetAngle
public float getTargetAngle()Return the target angle of the motor. The constraint is unaffected.- Returns:
- the angle (in radians)
-
getTargetAngularVelocity
public float getTargetAngularVelocity()Return the target angular velocity of the motor. The constraint is unaffected.- Returns:
- the angular velocity (in radians 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 radians)max
- the desired upper limit (in radians)
-
setMaxFrictionTorque
public void setMaxFrictionTorque(float torque) Alter the maximum friction torque when not driven by a motor.- Parameters:
torque
- the desired torque (in Newton.meters)
-
setMotorState
Alter the state of the motor.- Parameters:
state
- the desired state (not null)
-
setTargetAngle
public void setTargetAngle(float angle) Alter the target angle of the motor.- Parameters:
angle
- the desired angle (in radians)
-
setTargetAngularVelocity
public void setTargetAngularVelocity(float omega) Alter the target angular velocity of the motor.- Parameters:
omega
- the desired angular velocity (in radians per second)
-