@@ -26,6 +26,7 @@ of this software and associated documentation files (the "Software"), to deal
2626import com .github .stephengold .joltjni .ContactManifold ;
2727import com .github .stephengold .joltjni .ContactSettings ;
2828import com .github .stephengold .joltjni .CustomContactListener ;
29+ import com .github .stephengold .joltjni .PhysicsSystem ;
2930import com .github .stephengold .joltjni .RVec3 ;
3031import com .github .stephengold .joltjni .SubShapeIdPair ;
3132import com .github .stephengold .joltjni .enumerate .ValidateResult ;
@@ -72,10 +73,11 @@ public class SamplesContactListener extends CustomContactListener {
7273 * @param settingsVa the virtual address of the contact settings (not zero)
7374 */
7475 @ Override
75- public void onContactAdded (long body1Va , long body2Va ,
76- long manifoldVa , long settingsVa ) {
77- ConstBody body1 = new Body (body1Va );
78- ConstBody body2 = new Body (body2Va );
76+ public void onContactAdded (
77+ long body1Va , long body2Va , long manifoldVa , long settingsVa ) {
78+ PhysicsSystem system = test .GetPhysicsSystem ();
79+ ConstBody body1 = new Body (system , body1Va );
80+ ConstBody body2 = new Body (system , body2Va );
7981 ConstContactManifold manifold = new ContactManifold (manifoldVa );
8082 ContactSettings settings = new ContactSettings (settingsVa );
8183 test .OnContactAdded (body1 , body2 , manifold , settings );
@@ -92,10 +94,11 @@ public void onContactAdded(long body1Va, long body2Va,
9294 * @param settingsVa the virtual address of the contact settings (not zero)
9395 */
9496 @ Override
95- public void onContactPersisted (long body1Va , long body2Va ,
96- long manifoldVa , long settingsVa ) {
97- ConstBody body1 = new Body (body1Va );
98- ConstBody body2 = new Body (body2Va );
97+ public void onContactPersisted (
98+ long body1Va , long body2Va , long manifoldVa , long settingsVa ) {
99+ PhysicsSystem system = test .GetPhysicsSystem ();
100+ ConstBody body1 = new Body (system , body1Va );
101+ ConstBody body2 = new Body (system , body2Va );
99102 ConstContactManifold manifold = new ContactManifold (manifoldVa );
100103 ContactSettings settings = new ContactSettings (settingsVa );
101104 test .OnContactPersisted (body1 , body2 , manifold , settings );
@@ -131,11 +134,12 @@ public void onContactRemoved(long pairVa) {
131134 * {@code ValidateResult})
132135 */
133136 @ Override
134- public int onContactValidate (long body1Va , long body2Va ,
135- double baseOffsetX , double baseOffsetY , double baseOffsetZ ,
136- long collisionResultVa ) {
137- ConstBody body1 = new Body (body1Va );
138- ConstBody body2 = new Body (body2Va );
137+ public int onContactValidate (
138+ long body1Va , long body2Va , double baseOffsetX , double baseOffsetY ,
139+ double baseOffsetZ , long collisionResultVa ) {
140+ PhysicsSystem system = test .GetPhysicsSystem ();
141+ ConstBody body1 = new Body (system , body1Va );
142+ ConstBody body2 = new Body (system , body2Va );
139143 RVec3Arg baseOffset
140144 = new RVec3 (baseOffsetX , baseOffsetY , baseOffsetZ );
141145 CollideShapeResult collisionResult
0 commit comments