Skip to content

Commit

Permalink
CharacterRef: add removeFromPhysicsSystem() methods
Browse files Browse the repository at this point in the history
  • Loading branch information
stephengold committed Nov 11, 2024
1 parent b9e39d1 commit 5267d02
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -771,7 +771,7 @@ native static void getRotation(
native static void postSimulation(
long characterVa, float maxSeparation, boolean lockBodies);

native private static void removeFromPhysicsSystem(
native static void removeFromPhysicsSystem(
long characterVa, boolean lockBodies);

native private static void setLayer(
Expand Down
20 changes: 20 additions & 0 deletions src/main/java/com/github/stephengold/joltjni/CharacterRef.java
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,26 @@ public void postSimulation(float maxSeparation, boolean lockBodies) {
characterVa, maxSeparation, lockBodies);
}

/**
* Remove the character from its {@code PhysicsSystem} using the locking
* body interface.
*/
public void removeFromPhysicsSystem() {
removeFromPhysicsSystem(true);
}

/**
* Remove the character from its {@code PhysicsSystem}.
*
* @param lockBodies {@code true} → use the locking body interface,
* {@code false} → use the non-locking body interface (default=true)
*/
public void removeFromPhysicsSystem(boolean lockBodies) {
long characterVa = targetVa();
com.github.stephengold.joltjni.Character.removeFromPhysicsSystem(
characterVa, lockBodies);
}

/**
* Restore the character's state from the specified recorder.
*
Expand Down

0 comments on commit 5267d02

Please sign in to comment.