Interface ConstPhysicsSystem
- All Superinterfaces:
AutoCloseable,Comparable<JoltPhysicsObject>,ConstJoltPhysicsObject
- All Known Implementing Classes:
PhysicsSystem
Read-only access to a
PhysicsSystem.-
Method Summary
Modifier and TypeMethodDescriptionbooleancontainsConstraint(ConstConstraint constraint) Test whether the system contains the specified constraint.voidgetActiveBodies(EBodyType bodyType, BodyIdVector storeResult) Enumerate all bodies of the specified type to the specified vector.voidgetBodies(BodyIdVector storeResult) Enumerate all bodies to the specified variable-length vector.Access the system'sBodyActivationListener.Access the system'sBodyLockInterfaceLocking.Access the system'sBodyLockInterfaceNoLock.Generate a bounding box that contains all the bodies in the system.Access the system's interface for coarse collision queries.Access the combining function for friction.Access the combining function for restitutions.Enumerate all constraints in the system.Access the (application-provided) contact listener.getDefaultBroadPhaseLayerFilter(int objectLayer) Generate a broad-phase layer filter using the current pair filter and the specified layer index.getDefaultLayerFilter(int objectLayer) Generate an object layer filter using the current pair filter and the specified layer index.Copy the gravity vector.intReturn the maximum number of bodies the system supports.Access the system's interface for fine collision queries.Access a version of the system'sNarrowPhaseQuerythat does not lock the bodies.intgetNumActiveBodies(EBodyType bodyType) Count how many active bodies of the specified type there are in the body manager.intCount how many bodies there are in the body manager.Access the (application-provided) interface for testing whether 2 objects can collide, based on their object layers.Access the (application-provided) interface for testing whether an object can collide with a broad-phase layer.Copy the system's settings.Access the (application-provided) soft-body contact listener.voidsaveState(StateRecorder recorder) Save the system's state to be replayed later.voidsaveState(StateRecorder recorder, int bitmask) Save the aspects of the system's state to be replayed later.voidsaveState(StateRecorder recorder, int bitmask, StateRecorderFilter filter) Save aspects of the system's state to be replayed later.Methods inherited from interface java.lang.Comparable
compareToMethods inherited from interface com.github.stephengold.joltjni.readonly.ConstJoltPhysicsObject
close, hasAssignedNativeObject, ownsNativeObject, targetVa
-
Method Details
-
containsConstraint
Test whether the system contains the specified constraint. The system is unaffected.- Parameters:
constraint- the constraint to search for (notnull, unaffected)- Returns:
trueif found, otherwisefalse
-
getActiveBodies
Enumerate all bodies of the specified type to the specified vector.- Parameters:
bodyType- (notnull)storeResult- storage for the result (notnull)
-
getBodies
Enumerate all bodies to the specified variable-length vector. The system is unaffected.- Parameters:
storeResult- storage for the result (notnull)
-
getBodyActivationListener
BodyActivationListener getBodyActivationListener()Access the system'sBodyActivationListener.- Returns:
- a new JVM object with the pre-existing native object assigned, or
nullif none
-
getBodyLockInterface
ConstBodyLockInterfaceLocking getBodyLockInterface()Access the system'sBodyLockInterfaceLocking.- Returns:
- a new JVM object with the pre-existing native object assigned
-
getBodyLockInterfaceNoLock
ConstBodyLockInterfaceNoLock getBodyLockInterfaceNoLock()Access the system'sBodyLockInterfaceNoLock.- Returns:
- a new JVM object with the pre-existing native object assigned
-
getBounds
AaBox getBounds()Generate a bounding box that contains all the bodies in the system. The system is unaffected.- Returns:
- a new box
-
getBroadPhaseQuery
ConstBroadPhaseQuery getBroadPhaseQuery()Access the system's interface for coarse collision queries.- Returns:
- the pre-existing JVM object, or
nullif the system hasn't been initialized yet
-
getCombineFriction
CombineFunction getCombineFriction()Access the combining function for friction.- Returns:
- a new JVM object with the pre-existing native object assigned
-
getCombineRestitution
CombineFunction getCombineRestitution()Access the combining function for restitutions.- Returns:
- a new JVM object with the pre-existing native object assigned
-
getConstraints
Constraints getConstraints()Enumerate all constraints in the system. The system is unaffected.- Returns:
- a new object
-
getContactListener
ContactListener getContactListener()Access the (application-provided) contact listener.- Returns:
- the pre-existing instance, or
nullif none
-
getDefaultBroadPhaseLayerFilter
Generate a broad-phase layer filter using the current pair filter and the specified layer index.- Parameters:
objectLayer- the index of the object layer to use- Returns:
- a new filter
-
getDefaultLayerFilter
Generate an object layer filter using the current pair filter and the specified layer index.- Parameters:
objectLayer- the index of the object layer to use- Returns:
- a new filter
-
getGravity
Vec3 getGravity()Copy the gravity vector. The system is unaffected.- Returns:
- a new acceleration vector (meters per second squared in system coordinates)
-
getMaxBodies
int getMaxBodies()Return the maximum number of bodies the system supports. The system is unaffected.- Returns:
- the count (≥0)
-
getNarrowPhaseQuery
ConstNarrowPhaseQuery getNarrowPhaseQuery()Access the system's interface for fine collision queries.- Returns:
- the pre-existing JVM object (not
null)
-
getNarrowPhaseQueryNoLock
ConstNarrowPhaseQuery getNarrowPhaseQueryNoLock()Access a version of the system'sNarrowPhaseQuerythat does not lock the bodies.- Returns:
- the pre-existing JVM object (not
null)
-
getNumActiveBodies
Count how many active bodies of the specified type there are in the body manager. The system is unaffected.- Parameters:
bodyType- which type of body to count (notnull)- Returns:
- the count (≥0, ≤maxBodies)
-
getNumBodies
int getNumBodies()Count how many bodies there are in the body manager. The system is unaffected.- Returns:
- the count (≥0, ≤maxBodies)
-
getObjectLayerPairFilter
ConstObjectLayerPairFilter getObjectLayerPairFilter()Access the (application-provided) interface for testing whether 2 objects can collide, based on their object layers.- Returns:
- the pre-existing instance, or
nullif none
-
getObjectVsBroadPhaseLayerFilter
ConstObjectVsBroadPhaseLayerFilter getObjectVsBroadPhaseLayerFilter()Access the (application-provided) interface for testing whether an object can collide with a broad-phase layer.- Returns:
- the pre-existing instance, or
nullif none
-
getPhysicsSettings
PhysicsSettings getPhysicsSettings()Copy the system's settings. The system is unaffected.Different semantics from the native
GetPhysicsSettings(), which returns a const reference, not a copy.- Returns:
- a new JVM object with a new native object assigned
-
getSoftBodyContactListener
SoftBodyContactListener getSoftBodyContactListener()Access the (application-provided) soft-body contact listener.- Returns:
- the pre-existing instance, or
nullif none
-
saveState
Save the system's state to be replayed later.- Parameters:
recorder- where to save the state (notnull)
-
saveState
Save the aspects of the system's state to be replayed later.- Parameters:
recorder- where to save the state (notnull)bitmask- which aspects of the simulation to save
-
saveState
Save aspects of the system's state to be replayed later.- Parameters:
recorder- where to save the state (notnull)bitmask- which aspects of the simulation to savefilter- select which parts to save (unaffected) ornull
-