Skip to content

Commit 92b0d25

Browse files
committed
update Jolt Physics to sg260506 and update CharacterContactListener
1 parent 45e74ee commit 92b0d25

15 files changed

Lines changed: 173 additions & 350 deletions

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ plugins {
1919

2020
ext {
2121
joltFork = 'stephengold'
22-
joltTag = 'sg260504'
22+
joltTag = 'sg260506'
2323
downloadedHairStraightZip = "downloads/wStraightHair.zip"
2424
downloadedJoltZip = "downloads/JoltPhysics-${joltTag}.zip"
2525
downloadedVhacdZip = 'downloads/v-hacd-4.1.0.zip'

src/main/java/com/github/stephengold/joltjni/CharacterContactListener.java

Lines changed: 23 additions & 91 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
Copyright (c) 2024-2025 Stephen Gold
2+
Copyright (c) 2024-2026 Stephen Gold
33
44
Permission is hereby granted, free of charge, to any person obtaining a copy
55
of this software and associated documentation files (the "Software"), to deal
@@ -50,59 +50,27 @@ void onAdjustBodyVelocity(
5050
*
5151
* @param characterVa the virtual address of the {@code CharacterVirtual}
5252
* being solved (not zero)
53-
* @param otherCharacterVa the virtual address of the other
54-
* {@code CharacterVirtual} (not zero)
55-
* @param subShapeId2 the {@code SubShapeID} of the shape that is in contact
56-
* @param contactLocationX the X component of the contact location (in
57-
* system coordinates)
58-
* @param contactLocationY the Y component of the contact location (in
59-
* system coordinates)
60-
* @param contactLocationZ the Z component of the contact location (in
61-
* system coordinates)
62-
* @param contactNormalX the X component of the contact normal (in system
63-
* coordinates)
64-
* @param contactNormalY the Y component of the contact normal (in system
65-
* coordinates)
66-
* @param contactNormalZ the Z component of the contact normal (in system
67-
* coordinates)
53+
* @param contactVa the virtual address of the {@code Contact} (not zero)
6854
* @param settingsVa the virtual address of the
69-
* {@code CharacterContactSettings} for storing the desired behavior
55+
* {@code CharacterContactSettings} for storing the desired behavior (not
56+
* zero)
7057
*/
71-
void onCharacterContactAdded(long characterVa, long otherCharacterVa,
72-
int subShapeId2, double contactLocationX,
73-
double contactLocationY, double contactLocationZ,
74-
float contactNormalX, float contactNormalY, float contactNormalZ,
75-
long settingsVa);
58+
void onCharacterContactAdded(
59+
long characterVa, long contactVa, long settingsVa);
7660

7761
/**
7862
* Callback invoked (by native code) whenever a contact between 2 characters
7963
* becomes persistent.
8064
*
8165
* @param characterVa the virtual address of the {@code CharacterVirtual}
8266
* being solved (not zero)
83-
* @param otherCharacterVa the virtual address of the other
84-
* {@code CharacterVirtual} (not zero)
85-
* @param subShapeId2 the {@code SubShapeID} of the shape that is in contact
86-
* @param contactLocationX the X component of the contact location (in
87-
* system coordinates)
88-
* @param contactLocationY the Y component of the contact location (in
89-
* system coordinates)
90-
* @param contactLocationZ the Z component of the contact location (in
91-
* system coordinates)
92-
* @param contactNormalX the X component of the contact normal (in system
93-
* coordinates)
94-
* @param contactNormalY the Y component of the contact normal (in system
95-
* coordinates)
96-
* @param contactNormalZ the Z component of the contact normal (in system
97-
* coordinates)
67+
* @param contactVa the virtual address of the {@code Contact} (not zero)
9868
* @param settingsVa the virtual address of the
99-
* {@code CharacterContactSettings} for storing the desired behavior
69+
* {@code CharacterContactSettings} for storing the desired behavior (not
70+
* zero)
10071
*/
101-
void onCharacterContactPersisted(long characterVa, long otherCharacterVa,
102-
int subShapeId2, double contactLocationX,
103-
double contactLocationY, double contactLocationZ,
104-
float contactNormalX, float contactNormalY, float contactNormalZ,
105-
long settingsVa);
72+
void onCharacterContactPersisted(
73+
long characterVa, long contactVa, long settingsVa);
10674

10775
/**
10876
* Callback invoked (by native code) whenever a contact between 2 characters
@@ -169,70 +137,36 @@ void onCharacterContactSolve(long characterVa, long otherCharacterVa,
169137
*
170138
* @param characterVa the virtual address of the {@code CharacterVirtual}
171139
* being solved (not zero)
172-
* @param otherCharacterVa the virtual address of the other
173-
* {@code CharacterVirtual} (not zero)
174-
* @param subShapeId2 the {@code SubShapeID} of the shape that is in contact
140+
* @param contactVa the virtual address of the {@code Contact} (not zero)
175141
* @return {@code true} if the contact is valid, otherwise {@code false}
176142
*/
177-
boolean onCharacterContactValidate(
178-
long characterVa, long otherCharacterVa, int subShapeId2);
143+
boolean onCharacterContactValidate(long characterVa, long contactVa);
179144

180145
/**
181146
* Callback invoked (by native code) whenever a character collides with a
182147
* body.
183148
*
184149
* @param characterVa the virtual address of the {@code CharacterVirtual}
185150
* being solved (not zero)
186-
* @param bodyId2 the ID of the body being solved
187-
* @param subShapeId2 the {@code SubShapeID} of the shape that is in contact
188-
* @param contactLocationX the X component of the contact location (in
189-
* system coordinates)
190-
* @param contactLocationY the Y component of the contact location (in
191-
* system coordinates)
192-
* @param contactLocationZ the Z component of the contact location (in
193-
* system coordinates)
194-
* @param contactNormalX the X component of the contact normal (in system
195-
* coordinates)
196-
* @param contactNormalY the Y component of the contact normal (in system
197-
* coordinates)
198-
* @param contactNormalZ the Z component of the contact normal (in system
199-
* coordinates)
151+
* @param contactVa the virtual address of the {@code Contact} (not zero)
200152
* @param settingsVa the virtual address of the
201-
* {@code CharacterContactSettings} for storing the desired behavior
153+
* {@code CharacterContactSettings} for storing the desired behavior (not
154+
* zero)
202155
*/
203-
void onContactAdded(long characterVa, int bodyId2, int subShapeId2,
204-
double contactLocationX, double contactLocationY,
205-
double contactLocationZ, float contactNormalX, float contactNormalY,
206-
float contactNormalZ, long settingsVa);
156+
void onContactAdded(long characterVa, long contactVa, long settingsVa);
207157

208158
/**
209159
* Callback invoked (by native code) whenever a contact between a character
210160
* and a body becomes persistent.
211161
*
212162
* @param characterVa the virtual address of the {@code CharacterVirtual}
213163
* being solved (not zero)
214-
* @param bodyId2 the ID of the body being solved
215-
* @param subShapeId2 the {@code SubShapeID} of the shape that is in contact
216-
* @param contactLocationX the X component of the contact location (in
217-
* system coordinates)
218-
* @param contactLocationY the Y component of the contact location (in
219-
* system coordinates)
220-
* @param contactLocationZ the Z component of the contact location (in
221-
* system coordinates)
222-
* @param contactNormalX the X component of the contact normal (in system
223-
* coordinates)
224-
* @param contactNormalY the Y component of the contact normal (in system
225-
* coordinates)
226-
* @param contactNormalZ the Z component of the contact normal (in system
227-
* coordinates)
164+
* @param contactVa the virtual address of the {@code Contact} (not zero)
228165
* @param settingsVa the virtual address of the
229-
* {@code CharacterContactSettings} for storing the desired behavior
166+
* {@code CharacterContactSettings} for storing the desired behavior (not
167+
* zero)
230168
*/
231-
void onContactPersisted(long characterVa, int bodyId2,
232-
int subShapeId2, double contactLocationX,
233-
double contactLocationY, double contactLocationZ,
234-
float contactNormalX, float contactNormalY, float contactNormalZ,
235-
long settingsVa);
169+
void onContactPersisted(long characterVa, long contactVa, long settingsVa);
236170

237171
/**
238172
* Callback invoked (by native code) whenever a contact between a character
@@ -296,10 +230,8 @@ void onContactSolve(long characterVa, int bodyId2, int subShapeId2,
296230
*
297231
* @param characterVa the virtual address of the {@code CharacterVirtual}
298232
* being solved (not zero)
299-
* @param bodyId2 the ID of the body being solved
300-
* @param subShapeId2 the {@code SubShapeID} of the shape that is in contact
301-
* (not zero)
233+
* @param contactVa the virtual address of the {@code Contact} (not zero)
302234
* @return {@code true} if the contact is valid, otherwise {@code false}
303235
*/
304-
boolean onContactValidate(long characterVa, int bodyId2, int subShapeId2);
236+
boolean onContactValidate(long characterVa, long contactVa);
305237
}

src/main/java/com/github/stephengold/joltjni/Contact.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ of this software and associated documentation files (the "Software"), to deal
2929

3030
/**
3131
* Describe a contact between a {@code Character} and a body or another
32-
* character. (native type: {@code CharacterVirtual::Contact})
32+
* character. (native type: {@code CharacterContact})
3333
*
3434
* @author Stephen Gold sgold@sonic.net
3535
*/
@@ -53,8 +53,10 @@ public class Contact extends ContactKey implements ConstContact {
5353
* {@code false} → it isn't the owner
5454
* @param system the physics system in which the contact is occurring (not
5555
* {@code null})
56+
* <p>
57+
* For use in custom contact listeners.
5658
*/
57-
Contact(long contactVa, boolean owner, PhysicsSystem system) {
59+
public Contact(long contactVa, boolean owner, PhysicsSystem system) {
5860
super(false);
5961
assert system != null;
6062
this.system = system;

src/main/java/com/github/stephengold/joltjni/ContactKey.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ of this software and associated documentation files (the "Software"), to deal
2525

2626
/**
2727
* Identify a contact between a virtual character and a body or another virtual
28-
* character. (native type: {@code CharacterVirtual::ContactKey})
28+
* character. (native type: {@code CharacterContactKey})
2929
*
3030
* @author Stephen Gold sgold@sonic.net
3131
*/

src/main/java/com/github/stephengold/joltjni/ContactSet.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ of this software and associated documentation files (the "Software"), to deal
2727

2828
/**
2929
* A variable-length array of contact keys. (native type:
30-
* {@code Array<CharacterVirtual::ContactKey>})
30+
* {@code Array<CharacterContactKey>})
3131
*
3232
* @author Stephen Gold sgold@sonic.net
3333
*/

0 commit comments

Comments
 (0)