java.lang.Object
com.github.stephengold.joltjni.JoltPhysicsObject
com.github.stephengold.joltjni.MotorSettings
- All Implemented Interfaces:
ConstJoltPhysicsObject,ConstMotorSettings,AutoCloseable,Comparable<JoltPhysicsObject>
Settings used to construct a constraint motor.
-
Constructor Summary
ConstructorsConstructorDescriptionInstantiate default settings.MotorSettings(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.MotorSettings(ConstMotorSettings original) Instantiate a copy of the specified settings. -
Method Summary
Modifier and TypeMethodDescriptionAccess the underlyingConstraint, if any.Access the underlyingConstraintSettings, if any.floatReturn the maximum force to apply in a linear constraint.floatReturn the maximum torque to apply in an angular constraint.floatReturn the minimum force to apply in a linear constraint.floatReturn the minimum torque to apply in an angular constraint.Access the settings for the spring used to drive to the position target.booleanisValid()Test whether the settings are valid.voidsetForceLimit(float limit) Alter both force limits of a linear motor to be symmetrical.voidsetForceLimits(float min, float max) Alter both force limits of a linear motor.voidsetMaxForceLimit(float force) Alter the maximum force to apply in a linear constraint.voidsetMaxTorqueLimit(float torque) Alter the maximum torque to apply in an angular constraint.voidsetMinForceLimit(float force) Alter the minimum force to apply in a linear constraint.voidsetMinTorqueLimit(float torque) Alter the minimum torque to apply in an angular constraint.voidsetTorqueLimit(float limit) Alter both torque limits of an angular motor to be symmetrical.voidsetTorqueLimits(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, isCleanerStarted, ownsNativeObject, setVirtualAddress, setVirtualAddress, startCleaner, targetVa, toString, vaMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.lang.Comparable
compareToMethods inherited from interface com.github.stephengold.joltjni.readonly.ConstJoltPhysicsObject
close, hasAssignedNativeObject, ownsNativeObject, targetVa
-
Constructor Details
-
MotorSettings
public MotorSettings()Instantiate default settings. -
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
-
MotorSettings
Instantiate a copy of the specified settings.- Parameters:
original- the settings to copy (notnull, unaffected)
-
-
Method Details
-
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)
-
getConstraint
Access the underlyingConstraint, if any.- Specified by:
getConstraintin interfaceConstMotorSettings- Returns:
- the pre-existing instance, or
nullif none
-
getConstraintSettings
Access the underlyingConstraintSettings, if any.- Specified by:
getConstraintSettingsin interfaceConstMotorSettings- Returns:
- the pre-existing instance, or
nullif 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)- Specified by:
getMaxForceLimitin interfaceConstMotorSettings- 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)- Specified by:
getMaxTorqueLimitin interfaceConstMotorSettings- 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)- Specified by:
getMinForceLimitin interfaceConstMotorSettings- 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)- Specified by:
getMinTorqueLimitin interfaceConstMotorSettings- 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)- Specified by:
getSpringSettingsin interfaceConstMotorSettings- 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.- Specified by:
isValidin interfaceConstMotorSettings- Returns:
trueif valid, otherwisefalse
-