Package com.github.stephengold.joltjni
Class PhysicsScene
java.lang.Object
com.github.stephengold.joltjni.JoltPhysicsObject
com.github.stephengold.joltjni.PhysicsScene
- All Implemented Interfaces:
ConstJoltPhysicsObject,RefTarget,AutoCloseable,Comparable<ConstJoltPhysicsObject>
The creation settings of a set of bodies.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleancreateBodies(PhysicsSystem system) Instantiate the bodies in the scene.booleanCorrect any incorrectly scaled shapes in the scene.voidfromPhysicsSystem(PhysicsSystem system) Load the current state of the specified physics system.Access the body-creation settings as a Java array.intCount the active references to the nativePhysicsScene.voidsaveBinaryState(StreamOut stream, boolean saveShapes, boolean saveGroupFilter) Save the state of this object in binary form.voidMark the nativePhysicsSceneas embedded.toRef()Create a counted reference to the nativePhysicsScene.Methods inherited from class com.github.stephengold.joltjni.JoltPhysicsObject
close, compareTo, equals, hasAssignedNativeObject, hashCode, ownsNativeObject, setVirtualAddress, startCleaner, toString, va
-
Constructor Details
-
PhysicsScene
public PhysicsScene()Instantiate an empty scene.
-
-
Method Details
-
fixInvalidScales
public boolean fixInvalidScales()Correct any incorrectly scaled shapes in the scene.- Returns:
- true if successful, otherwise false
-
fromPhysicsSystem
Load the current state of the specified physics system.- Parameters:
system- the physics system to load from (not null, unaffected)
-
getBodies
Access the body-creation settings as a Java array.- Returns:
- a new array of new JVM objects with the pre-existing native objects assigned
-
createBodies
Instantiate the bodies in the scene.- Parameters:
system- where to add the bodies (not null, modified)- Returns:
- true if successful, otherwise false
-
saveBinaryState
Save the state of this object in binary form.- Parameters:
stream- the stream to write to (not null)saveShapes- if true, save the shapessaveGroupFilter- if true, save the group filter
-
getRefCount
public int getRefCount()Count the active references to the nativePhysicsScene. The scene is unaffected.- Specified by:
getRefCountin interfaceRefTarget- Returns:
- the count (≥0)
-
setEmbedded
public void setEmbedded()Mark the nativePhysicsSceneas embedded.- Specified by:
setEmbeddedin interfaceRefTarget
-
toRef
Create a counted reference to the nativePhysicsScene.
-