java.lang.Object
com.github.stephengold.joltjni.JoltPhysicsObject
com.github.stephengold.joltjni.MotorSettings
- All Implemented Interfaces:
ConstJoltPhysicsObject
,AutoCloseable
,Comparable<JoltPhysicsObject>
Settings used to construct a constraint motor.
-
Constructor Summary
ConstructorsConstructorDescriptionMotorSettings
(float frequency, float damping) Instantiate settings for the specified spring parameters with no limits.MotorSettings
(float frequency, float damping, float forceLimit, float torqueLimit) Instantiate settings for the specified spring parameters and limits. -
Method Summary
Modifier and TypeMethodDescriptionAccess the underlyingConstraint
, if any.Access the underlyingConstraintSettings
, if any.float
Return the maximum force to apply in a linear constraint.float
Return the maximum torque to apply in an angular constraint.float
Return the minimum force to apply in a linear constraint.float
Return the minimum torque to apply in an angular constraint.Access the settings for the spring used to drive to the position target.boolean
isValid()
Test whether the settings are valid.void
setForceLimit
(float limit) Alter both force limits of a linear motor to be symmetrical.void
setForceLimits
(float min, float max) Alter both force limits of a linear motor.void
setMaxForceLimit
(float force) Alter the maximum force to apply in a linear constraint.void
setMaxTorqueLimit
(float torque) Alter the maximum torque to apply in an angular constraint.void
setMinForceLimit
(float force) Alter the minimum force to apply in a linear constraint.void
setMinTorqueLimit
(float torque) Alter the minimum torque to apply in an angular constraint.void
setTorqueLimit
(float limit) Alter both torque limits of an angular motor to be symmetrical.void
setTorqueLimits
(float min, float max) Alter both torque limits of an angular motor.Methods inherited from class com.github.stephengold.joltjni.JoltPhysicsObject
close, compareTo, equals, getContainingObject, hasAssignedNativeObject, hashCode, ownsNativeObject, setVirtualAddress, setVirtualAddress, startCleaner, targetVa, toString, va
-
Constructor Details
-
MotorSettings
public MotorSettings(float frequency, float damping) Instantiate settings for the specified spring parameters with no limits.- Parameters:
frequency
- the desired spring frequency (in Hertz)damping
- the desired damping
-
MotorSettings
public MotorSettings(float frequency, float damping, float forceLimit, float torqueLimit) Instantiate settings for the specified spring parameters and limits.- Parameters:
frequency
- the desired spring frequency (in Hertz)damping
- the desired dampingforceLimit
- the desired force limittorqueLimit
- the desired torque limit
-
-
Method Details
-
getConstraint
Access the underlyingConstraint
, if any.- Returns:
- the pre-existing instance, or
null
if none
-
getConstraintSettings
Access the underlyingConstraintSettings
, if any.- Returns:
- the pre-existing instance, or
null
if none
-
getMaxForceLimit
public float getMaxForceLimit()Return the maximum force to apply in a linear constraint. Ignored in an angular motor. The settings are unaffected. (native attribute: mMaxForceLimit)- Returns:
- the amount of force (in Newtons, typically positive)
-
getMaxTorqueLimit
public float getMaxTorqueLimit()Return the maximum torque to apply in an angular constraint. Ignored in a linear motor. The settings are unaffected. (native attribute: mMaxTorqueLimit)- Returns:
- the amount of torque (in Newton.meters, typically positive)
-
getMinForceLimit
public float getMinForceLimit()Return the minimum force to apply in a linear constraint. Ignored in an angular motor. The settings are unaffected. (native attribute: mMinForceLimit)- Returns:
- the amount of force (in Newtons, typically negative)
-
getMinTorqueLimit
public float getMinTorqueLimit()Return the minimum torque to apply in an angular constraint. Ignored in a linear motor. The settings are unaffected. (native attribute: mMinTorqueLimit)- Returns:
- the amount of torque (in Newton.meters, typically negative)
-
getSpringSettings
Access the settings for the spring used to drive to the position target. Ignored in a velocity motor. The motor settings are unaffected. (native attribute: mSpringSettings)- Returns:
- a new JVM object with the pre-existing native object assigned
-
isValid
public boolean isValid()Test whether the settings are valid. They are unaffected.- Returns:
true
if valid, otherwisefalse
-
setForceLimit
public void setForceLimit(float limit) Alter both force limits of a linear motor to be symmetrical.- Parameters:
limit
- the desired limit (in Newtons)
-
setForceLimits
public void setForceLimits(float min, float max) Alter both force limits of a linear motor.- Parameters:
min
- the desired lower limit (in Newtons, default=-MAX_FLOAT)max
- the desired upper limit (in Newtons, default=MAX_FLOAT)
-
setMaxForceLimit
public void setMaxForceLimit(float force) Alter the maximum force to apply in a linear constraint. Ignored in an angular motor. (native attribute: mMaxForceLimit)- Parameters:
force
- the desired amount of force (in Newtons, typically positive, default=MAX_VALUE)
-
setMaxTorqueLimit
public void setMaxTorqueLimit(float torque) Alter the maximum torque to apply in an angular constraint. Ignored in a linear motor. (native attribute: mMaxTorqueLimit)- Parameters:
torque
- the desired amount of torque (in Newton.meters, typically positive, default=MAX_VALUE)
-
setMinForceLimit
public void setMinForceLimit(float force) Alter the minimum force to apply in a linear constraint. Ignored in an angular motor. (native attribute: mMinForceLimit)- Parameters:
force
- the desired amount of force (in Newtons, typically negative, default=-MAX_VALUE)
-
setMinTorqueLimit
public void setMinTorqueLimit(float torque) Alter the minimum torque to apply in an angular constraint. Ignored in a linear motor. (native attribute: mMinTorqueLimit)- Parameters:
torque
- the desired amount of torque (in Newton.meters, typically negative, default=-MAX_VALUE)
-
setTorqueLimit
public void setTorqueLimit(float limit) Alter both torque limits of an angular motor to be symmetrical.- Parameters:
limit
- the desired upper limit (in Newton.meters)
-
setTorqueLimits
public void setTorqueLimits(float min, float max) Alter both torque limits of an angular motor.- Parameters:
min
- the desired lower limit (in Newton.meters, default=-MAX_FLOAT)max
- the desired upper limit (in Newton.meters, default=MAX_FLOAT)
-