Package com.github.stephengold.joltjni
Class VehicleConstraint
java.lang.Object
com.github.stephengold.joltjni.JoltPhysicsObject
com.github.stephengold.joltjni.NonCopyable
com.github.stephengold.joltjni.Constraint
com.github.stephengold.joltjni.VehicleConstraint
- All Implemented Interfaces:
PhysicsStepListener,ConstConstraint,ConstJoltPhysicsObject,RefTarget,AutoCloseable,Comparable<ConstJoltPhysicsObject>
A constraint used in vehicle simulation.
-
Constructor Summary
ConstructorsConstructorDescriptionVehicleConstraint(Body body, VehicleConstraintSettings settings) Instantiate a constraint using the specified body and settings. -
Method Summary
Modifier and TypeMethodDescriptionAccess the controller for this constraint.Access the vehicle body.Access the underlying tester, if any.getWheel(int wheelIndex) Access the specified wheel.getWheelWorldTransform(int wheelIndex, Vec3Arg right, Vec3Arg up) Copy the world transform of the specified wheel.voidonStep(long contextVa) Callback invoked (by native code) each time the system is stepped.voidsetNumStepsBetweenCollisionTestActive(int numSteps) Return the number of simulation steps between wheel collision tests when the vehicle is active.voidsetNumStepsBetweenCollisionTestInactive(int numSteps) Return the number of simulation steps between wheel collision tests when the vehicle is inactive.voidReplace the collision tester.Methods inherited from class com.github.stephengold.joltjni.Constraint
getConstraintPriority, getConstraintSettings, getEnabled, getNumPositionStepsOverride, getNumVelocityStepsOverride, getRefCount, getSubType, getType, getUserData, setConstraintPriority, setEmbedded, setEnabled, setNumPositionStepsOverride, setNumVelocityStepsOverride, setUserData, toRefMethods inherited from class com.github.stephengold.joltjni.JoltPhysicsObject
close, compareTo, equals, hasAssignedNativeObject, hashCode, ownsNativeObject, 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, va
-
Constructor Details
-
VehicleConstraint
Instantiate a constraint using the specified body and settings.- Parameters:
body- the body to which the constraint will apply (not null)settings- the desired settings (not null, unaffected)
-
-
Method Details
-
getController
Access the controller for this constraint.- Returns:
- a new JVM object with the pre-existing native object assigned
-
getVehicleBody
Access the vehicle body.- Returns:
- a new JVM object with the pre-existing native object assigned
-
getVehicleCollisionTester
Access the underlying tester, if any.- Returns:
- the pre-existing instance or
nullif none
-
getWheel
Access the specified wheel.- Parameters:
wheelIndex- the index of the wheel to access (≥0)- Returns:
- a new JVM object with the pre-existing native object assigned
-
getWheelWorldTransform
Copy the world transform of the specified wheel.- 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
-
setNumStepsBetweenCollisionTestActive
public void setNumStepsBetweenCollisionTestActive(int numSteps) Return the number of simulation steps between wheel collision tests when the vehicle is active.- Parameters:
numSteps- the desired number of steps (0=never test, 1=test every step, 2=test every other step, default=1)
-
setNumStepsBetweenCollisionTestInactive
public void setNumStepsBetweenCollisionTestInactive(int numSteps) Return the number of simulation steps between wheel collision tests when the vehicle is inactive.- Parameters:
numSteps- the desired number of steps (0=never, 1=every step, 2=every other step, default=1)
-
setVehicleCollisionTester
Replace the collision tester.- Parameters:
tester- the desired tester (not null, alias created)
-
onStep
public void onStep(long contextVa) Callback invoked (by native code) each time the system is stepped.- Specified by:
onStepin interfacePhysicsStepListener- Parameters:
contextVa- the virtual address of aPhysicsStepListenerContextPhysicsStepListenerContext(not zero)
-