Skip to content

Commit

Permalink
refactor the NarrowPhaseQuery class
Browse files Browse the repository at this point in the history
  • Loading branch information
stephengold committed Oct 15, 2024
1 parent b71bd93 commit 687c2b6
Showing 1 changed file with 3 additions and 12 deletions.
15 changes: 3 additions & 12 deletions src/main/java/com/github/stephengold/joltjni/NarrowPhaseQuery.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,27 +33,18 @@ of this software and associated documentation files (the "Software"), to deal
* @author Stephen Gold [email protected]
*/
public class NarrowPhaseQuery extends NonCopyable {
// *************************************************************************
// fields

/**
* prevent premature garbage collection of the underlying
* {@code PhysicsSystem}
*/
final private PhysicsSystem system;
// *************************************************************************
// constructors

/**
* Instantiate with the specified native object assigned but not owned.
*
* @param system the underlying {@code PhysicsSystem} (not null)
* @param system the containing object, or {@code null} if none
* @param queryVa the virtual address of the native object to assign (not
* zero)
*/
NarrowPhaseQuery(PhysicsSystem system, long queryVa) {
this.system = system;
setVirtualAddress(queryVa, null);
super(system, queryVa);
}
// *************************************************************************
// new methods exposed
Expand Down Expand Up @@ -555,7 +546,7 @@ public void collideShape(ConstShape shape, Vec3Arg shapeScale,
* @return the pre-existing instance
*/
public PhysicsSystem getSystem() {
return system;
return (PhysicsSystem) getContainingObject();
}
// *************************************************************************
// native private methods
Expand Down

0 comments on commit 687c2b6

Please sign in to comment.