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 TypeMethodDescriptionint
Count how many anti-roll bars the vehicle has.int
Count how many wheels the vehicle has.getAntiRollBar
(int barIndex) Access the specified anti-roll bar.int
Return the constraint's priority when solving.Generate settings to reconstruct the constraint.boolean
Test whether the constraint is enabled.Copy the gravity override.Copy the local "forward" direction.Copy the local "up" direction.float
Return the vehicle's maximum pitch/roll angle.int
Return the override for the number of position iterations used in the solver.int
Return the number of simulation steps between wheel-collision tests when the vehicle is active.int
Return the number of simulation steps between collision tests when the body is inactive.int
Return 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.void
getWheelLocalBasis
(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.boolean
isActive()
Test whether the constraint is active.boolean
Test whether gravity is overridden.void
overrideGravity
(float ax, float ay, float az) Override the vehicle's gravity vector.void
overrideGravity
(Vec3Arg acceleration) Override the vehicle's gravity vector.void
Remove the gravity override, if any.void
saveState
(StateRecorder recorder) Save the state of the constraint, for possible replay.long
targetVa()
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, 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.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:
countAntiRollBars
in interfaceConstVehicleConstraint
- Returns:
- the count (≥0)
-
countWheels
public int countWheels()Count how many wheels the vehicle has. The constraint is unaffected.- Specified by:
countWheels
in interfaceConstVehicleConstraint
- Returns:
- the count (≥0)
-
getAntiRollBar
Access the specified anti-roll bar.- Specified by:
getAntiRollBar
in 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:
getConstraintPriority
in interfaceConstConstraint
- Returns:
- the priority level
-
getConstraintSettings
Generate settings to reconstruct the constraint. The constraint is unaffected.- Specified by:
getConstraintSettings
in 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:
getEnabled
in interfaceConstConstraint
- Returns:
true
if enabled, otherwisefalse
-
getGravityOverride
Copy the gravity override. The constraint is unaffected.- Specified by:
getGravityOverride
in interfaceConstVehicleConstraint
- Returns:
- a new vector
-
getLocalForward
Copy the local "forward" direction. The constraint is unaffected.- Specified by:
getLocalForward
in interfaceConstVehicleConstraint
- Returns:
- a new direction vector
-
getLocalUp
Copy the local "up" direction. The constraint is unaffected.- Specified by:
getLocalUp
in interfaceConstVehicleConstraint
- Returns:
- a new direction vector
-
getMaxPitchRollAngle
public float getMaxPitchRollAngle()Return the vehicle's maximum pitch/roll angle. The constraint is unaffected.- Specified by:
getMaxPitchRollAngle
in 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:
getNumPositionStepsOverride
in 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:
getNumStepsBetweenCollisionTestActive
in 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:
getNumStepsBetweenCollisionTestInactive
in 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:
getNumVelocityStepsOverride
in 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:
getSubType
in interfaceConstConstraint
- Returns:
- an enum value (not null)
-
getType
Return the constraint's type. The constraint is unaffected.- Specified by:
getType
in interfaceConstConstraint
- Returns:
- an enum value (not null)
-
getWheelLocalBasis
Copy the basis vectors for the specified wheel.- Specified by:
getWheelLocalBasis
in 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:
getWheelWorldTransform
in 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:
getWorldUp
in 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:
isActive
in interfaceConstConstraint
- Returns:
true
if active, otherwisefalse
-
isGravityOverridden
public boolean isGravityOverridden()Test whether gravity is overridden. The constraint is unaffected.- Specified by:
isGravityOverridden
in interfaceConstVehicleConstraint
- Returns:
true
if overridden, otherwisefalse
-
saveState
Save the state of the constraint, for possible replay. The constraint is unaffected.- Specified by:
saveState
in 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:
targetVa
in interfaceConstJoltPhysicsObject
- Overrides:
targetVa
in classJoltPhysicsObject
- Returns:
- a virtual address (not zero)
-
toRef
Create another counted reference to the nativeVehicleConstraint
.
-