Package com.github.stephengold.joltjni
Class VehicleConstraintRef
java.lang.Object
com.github.stephengold.joltjni.JoltPhysicsObject
com.github.stephengold.joltjni.template.Ref
com.github.stephengold.joltjni.VehicleConstraintRef
- All Implemented Interfaces:
ConstConstraint,ConstJoltPhysicsObject,ConstVehicleConstraint,AutoCloseable,Comparable<JoltPhysicsObject>
A counted reference to a
VehicleConstraint. (native type:
Ref<VehicleConstraint>)-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintCount how many anti-roll bars the vehicle has.intCount how many wheels the vehicle has.getAntiRollBar(int barIndex) Access the specified anti-roll bar.intReturn the constraint's priority when solving.Generate settings to reconstruct the constraint.booleanTest whether the constraint is enabled.Copy the gravity override.Copy the local "forward" direction.Copy the local "up" direction.floatReturn the vehicle's maximum pitch/roll angle.intReturn the override for the number of position iterations used in the solver.intReturn the number of simulation steps between wheel-collision tests when the vehicle is active.intReturn the number of simulation steps between collision tests when the body is inactive.intReturn the override for the number of velocity iterations used in the solver.getPtr()Temporarily access the referencedVehicleConstraint.Return the constraint's subtype.getType()Return the constraint's type.voidgetWheelLocalBasis(Wheel wheel, Vec3 storeForward, Vec3 storeUp, Vec3 storeRight) Copy the basis vectors for the specified wheel.getWheelWorldTransform(int wheelIndex, Vec3Arg right, Vec3Arg up) Copy the world transform of the specified wheel.Copy the "up" direction based on gravity.booleanisActive()Test whether the constraint is active.booleanTest whether gravity is overridden.voidoverrideGravity(float ax, float ay, float az) Override the vehicle's gravity vector.voidoverrideGravity(Vec3Arg acceleration) Override the vehicle's gravity vector.voidRemove the gravity override, if any.voidsaveState(StateRecorder recorder) Save the state of the constraint, for possible replay.longtargetVa()Return the address of the nativeVehicleConstraint.toRef()Create another counted reference to the nativeVehicleConstraint.Methods inherited from class com.github.stephengold.joltjni.JoltPhysicsObject
close, compareTo, equals, getContainingObject, hasAssignedNativeObject, hashCode, isCleanerStarted, ownsNativeObject, setVirtualAddress, setVirtualAddress, startCleaner, 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
-
Constructor Details
-
VehicleConstraintRef
public VehicleConstraintRef()Instantiate an empty reference.
-
-
Method Details
-
overrideGravity
public void overrideGravity(float ax, float ay, float az) Override the vehicle's gravity vector.- Parameters:
ax- the X component of the desired acceleration vectoray- the Y component of the desired acceleration vectoraz- the Z component of the desired acceleration vector
-
overrideGravity
Override the vehicle's gravity vector.- Parameters:
acceleration- the desired acceleration vector (not null, unaffected)
-
resetGravityOverride
public void resetGravityOverride()Remove the gravity override, if any. -
countAntiRollBars
public int countAntiRollBars()Count how many anti-roll bars the vehicle has. The constraint is unaffected.- Specified by:
countAntiRollBarsin interfaceConstVehicleConstraint- Returns:
- the count (≥0)
-
countWheels
public int countWheels()Count how many wheels the vehicle has. The constraint is unaffected.- Specified by:
countWheelsin interfaceConstVehicleConstraint- Returns:
- the count (≥0)
-
getAntiRollBar
Access the specified anti-roll bar.- Specified by:
getAntiRollBarin interfaceConstVehicleConstraint- Parameters:
barIndex- the index of the bar to access (≥0)- Returns:
- a new JVM object with the pre-existing native object assigned
-
getConstraintPriority
public int getConstraintPriority()Return the constraint's priority when solving. The constraint is unaffected.- Specified by:
getConstraintPriorityin interfaceConstConstraint- Returns:
- the priority level
-
getConstraintSettings
Generate settings to reconstruct the constraint. The constraint is unaffected.- Specified by:
getConstraintSettingsin interfaceConstConstraint- Returns:
- a new counted reference to a new settings object
-
getEnabled
public boolean getEnabled()Test whether the constraint is enabled. The constraint is unaffected.- Specified by:
getEnabledin interfaceConstConstraint- Returns:
trueif enabled, otherwisefalse
-
getGravityOverride
Copy the gravity override. The constraint is unaffected.- Specified by:
getGravityOverridein interfaceConstVehicleConstraint- Returns:
- a new vector
-
getLocalForward
Copy the local "forward" direction. The constraint is unaffected.- Specified by:
getLocalForwardin interfaceConstVehicleConstraint- Returns:
- a new direction vector
-
getLocalUp
Copy the local "up" direction. The constraint is unaffected.- Specified by:
getLocalUpin interfaceConstVehicleConstraint- Returns:
- a new direction vector
-
getMaxPitchRollAngle
public float getMaxPitchRollAngle()Return the vehicle's maximum pitch/roll angle. The constraint is unaffected.- Specified by:
getMaxPitchRollAnglein interfaceConstVehicleConstraint- Returns:
- the limit angle (in radians)
-
getNumPositionStepsOverride
public int getNumPositionStepsOverride()Return the override for the number of position iterations used in the solver. The constraint is unaffected.- Specified by:
getNumPositionStepsOverridein interfaceConstConstraint- Returns:
- the number of iterations, or 0 to use the default in
PhysicsSettings
-
getNumStepsBetweenCollisionTestActive
public int getNumStepsBetweenCollisionTestActive()Return the number of simulation steps between wheel-collision tests when the vehicle is active. The constraint is unaffected.- Specified by:
getNumStepsBetweenCollisionTestActivein interfaceConstVehicleConstraint- Returns:
- the number of steps
-
getNumStepsBetweenCollisionTestInactive
public int getNumStepsBetweenCollisionTestInactive()Return the number of simulation steps between collision tests when the body is inactive. The constraint is unaffected.- Specified by:
getNumStepsBetweenCollisionTestInactivein interfaceConstVehicleConstraint- Returns:
- the number of steps
-
getNumVelocityStepsOverride
public int getNumVelocityStepsOverride()Return the override for the number of velocity iterations used in the solver. The constraint is unaffected.- Specified by:
getNumVelocityStepsOverridein interfaceConstConstraint- Returns:
- the number of iterations, or 0 to use the default in
PhysicsSettings
-
getSubType
Return the constraint's subtype. The constraint is unaffected.- Specified by:
getSubTypein interfaceConstConstraint- Returns:
- an enum value (not null)
-
getType
Return the constraint's type. The constraint is unaffected.- Specified by:
getTypein interfaceConstConstraint- Returns:
- an enum value (not null)
-
getWheelLocalBasis
Copy the basis vectors for the specified wheel.- Specified by:
getWheelLocalBasisin interfaceConstVehicleConstraint- Parameters:
wheel- which wheel to query (not null)storeForward- storage for the forward vector (not null, modified)storeUp- storage for the up vector (not null, modified)storeRight- storage for the right vector (not null, modified)
-
getWheelWorldTransform
Copy the world transform of the specified wheel. The constraint is unaffected.- Specified by:
getWheelWorldTransformin interfaceConstVehicleConstraint- Parameters:
wheelIndex- the index of the wheel to query (≥0)right- the wheel's axis of rotation (a unit vector in the wheel's model space)up- the "up" direction (a unit vector in the wheel's model space)- Returns:
- a new coordinate transform matrix
-
getWorldUp
Copy the "up" direction based on gravity. The constraint is unaffected.- Specified by:
getWorldUpin interfaceConstVehicleConstraint- Returns:
- a new direction vector (in system coordinates)
-
isActive
public boolean isActive()Test whether the constraint is active. The constraint is unaffected.- Specified by:
isActivein interfaceConstConstraint- Returns:
trueif active, otherwisefalse
-
isGravityOverridden
public boolean isGravityOverridden()Test whether gravity is overridden. The constraint is unaffected.- Specified by:
isGravityOverriddenin interfaceConstVehicleConstraint- Returns:
trueif overridden, otherwisefalse
-
saveState
Save the state of the constraint, for possible replay. The constraint is unaffected.- Specified by:
saveStatein interfaceConstConstraint- Parameters:
recorder- the recorder to write to (not null)
-
getPtr
Temporarily access the referencedVehicleConstraint. -
targetVa
public long targetVa()Return the address of the nativeVehicleConstraint. No objects are affected.- Specified by:
targetVain interfaceConstJoltPhysicsObject- Overrides:
targetVain classJoltPhysicsObject- Returns:
- a virtual address (not zero)
-
toRef
Create another counted reference to the nativeVehicleConstraint.
-