2121/**
2222 *
2323 */
24- public final class CharacterVirtualContact
25- implements Struct <CharacterVirtualContact > {
24+ public final class CharacterContact
25+ implements Struct <CharacterContact > {
2626
2727 public static final StructLayout LAYOUT ;
2828
@@ -40,6 +40,7 @@ public final class CharacterVirtualContact
4040 public static final VarHandle HAD_COLLISION_HANDLE ;
4141 public static final VarHandle WAS_DISCARDED_HANDLE ;
4242 public static final VarHandle CAN_PUSH_CHARACTER_HANDLE ;
43+ public static final VarHandle IS_BACK_FACING_CONTACT_HANDLE ;
4344
4445 public static final long HASH_BYTE_OFFSET ;
4546 public static final long BODY_B_BYTE_OFFSET ;
@@ -59,6 +60,7 @@ public final class CharacterVirtualContact
5960 public static final long HAD_COLLISION_BYTE_OFFSET ;
6061 public static final long WAS_DISCARDED_BYTE_OFFSET ;
6162 public static final long CAN_PUSH_CHARACTER_BYTE_OFFSET ;
63+ public static final long IS_BACK_FACING_CONTACT_BYTE_OFFSET ;
6264
6365 private final MemorySegment segment ;
6466
@@ -89,8 +91,9 @@ public final class CharacterVirtualContact
8991 JAVA_BOOLEAN .withName ("hadCollision" ),
9092 JAVA_BOOLEAN .withName ("wasDiscarded" ),
9193 JAVA_BOOLEAN .withName ("canPushCharacter" ),
92- MemoryLayout .paddingLayout (5 )
93- ).withName ("JPH_CharacterVirtualContact" ).withByteAlignment (8 );
94+ JAVA_BOOLEAN .withName ("isBackFacingContact" ),
95+ MemoryLayout .paddingLayout (4 )
96+ ).withName ("JPH_CharacterContact" ).withByteAlignment (8 );
9497
9598 HASH_HANDLE = LAYOUT .varHandle (PathElement .groupElement ("hash" ));
9699 BODY_B_HANDLE = LAYOUT .varHandle (PathElement .groupElement ("bodyB" ));
@@ -106,6 +109,7 @@ public final class CharacterVirtualContact
106109 HAD_COLLISION_HANDLE = LAYOUT .varHandle (PathElement .groupElement ("hadCollision" ));
107110 WAS_DISCARDED_HANDLE = LAYOUT .varHandle (PathElement .groupElement ("wasDiscarded" ));
108111 CAN_PUSH_CHARACTER_HANDLE = LAYOUT .varHandle (PathElement .groupElement ("canPushCharacter" ));
112+ IS_BACK_FACING_CONTACT_HANDLE = LAYOUT .varHandle (PathElement .groupElement ("isBackFacingContact" ));
109113
110114 HASH_BYTE_OFFSET = LAYOUT .byteOffset (PathElement .groupElement ("hash" ));
111115 BODY_B_BYTE_OFFSET = LAYOUT .byteOffset (PathElement .groupElement ("bodyB" ));
@@ -125,18 +129,19 @@ public final class CharacterVirtualContact
125129 HAD_COLLISION_BYTE_OFFSET = LAYOUT .byteOffset (PathElement .groupElement ("hadCollision" ));
126130 WAS_DISCARDED_BYTE_OFFSET = LAYOUT .byteOffset (PathElement .groupElement ("wasDiscarded" ));
127131 CAN_PUSH_CHARACTER_BYTE_OFFSET = LAYOUT .byteOffset (PathElement .groupElement ("canPushCharacter" ));
132+ IS_BACK_FACING_CONTACT_BYTE_OFFSET = LAYOUT .byteOffset (PathElement .groupElement ("isBackFacingContact" ));
128133 //@formatter:on
129134 }
130135
131- public CharacterVirtualContact () {
136+ public CharacterContact () {
132137 this (Arena .ofAuto ());
133138 }
134139
135- public CharacterVirtualContact (Arena arena ) {
140+ public CharacterContact (Arena arena ) {
136141 this (arena .allocate (LAYOUT ));
137142 }
138143
139- public CharacterVirtualContact (MemorySegment segment ) {
144+ public CharacterContact (MemorySegment segment ) {
140145 this .segment = segment ;
141146
142147 position = new Vec3 (segment .asSlice (POSITION_BYTE_OFFSET , Vec3 .LAYOUT ));
@@ -145,7 +150,7 @@ public CharacterVirtualContact(MemorySegment segment) {
145150 surfaceNormal = new Vec3 (segment .asSlice (SURFACE_NORMAL_BYTE_OFFSET , Vec3 .LAYOUT ));
146151 }
147152
148- public CharacterVirtualContact hash (long hash ) {
153+ public CharacterContact hash (long hash ) {
149154 HASH_HANDLE .set (segment , 0L , hash );
150155 return this ;
151156 }
@@ -154,7 +159,7 @@ public long hash() {
154159 return (long ) HASH_HANDLE .get (segment , 0L );
155160 }
156161
157- public CharacterVirtualContact bodyB (int bodyB ) {
162+ public CharacterContact bodyB (int bodyB ) {
158163 BODY_B_HANDLE .set (segment , 0L , bodyB );
159164 return this ;
160165 }
@@ -163,7 +168,7 @@ public int bodyB() {
163168 return (int ) BODY_B_HANDLE .get (segment , 0L );
164169 }
165170
166- public CharacterVirtualContact characterIDB (int characterIDB ) {
171+ public CharacterContact characterIDB (int characterIDB ) {
167172 CHARACTER_IDB_HANDLE .set (segment , 0L , characterIDB );
168173 return this ;
169174 }
@@ -172,7 +177,7 @@ public int characterIDB() {
172177 return (int ) CHARACTER_IDB_HANDLE .get (segment , 0L );
173178 }
174179
175- public CharacterVirtualContact subShapeIDB (int subShapeIDB ) {
180+ public CharacterContact subShapeIDB (int subShapeIDB ) {
176181 SUB_SHAPE_IDB_HANDLE .set (segment , 0L , subShapeIDB );
177182 return this ;
178183 }
@@ -181,7 +186,7 @@ public int subShapeIDB() {
181186 return (int ) SUB_SHAPE_IDB_HANDLE .get (segment , 0L );
182187 }
183188
184- public CharacterVirtualContact distance (float distance ) {
189+ public CharacterContact distance (float distance ) {
185190 DISTANCE_HANDLE .set (segment , 0L , distance );
186191 return this ;
187192 }
@@ -190,7 +195,7 @@ public float distance() {
190195 return (float ) DISTANCE_HANDLE .get (segment , 0L );
191196 }
192197
193- public CharacterVirtualContact fraction (float fraction ) {
198+ public CharacterContact fraction (float fraction ) {
194199 FRACTION_HANDLE .set (segment , 0L , fraction );
195200 return this ;
196201 }
@@ -199,7 +204,7 @@ public float fraction() {
199204 return (float ) FRACTION_HANDLE .get (segment , 0L );
200205 }
201206
202- public CharacterVirtualContact motionTypeB (int motionTypeB ) {
207+ public CharacterContact motionTypeB (int motionTypeB ) {
203208 MOTION_TYPE_B_HANDLE .set (segment , 0L , motionTypeB );
204209 return this ;
205210 }
@@ -208,7 +213,7 @@ public int motionTypeB() {
208213 return (int ) MOTION_TYPE_B_HANDLE .get (segment , 0L );
209214 }
210215
211- public CharacterVirtualContact isSensorB (boolean isSensorB ) {
216+ public CharacterContact isSensorB (boolean isSensorB ) {
212217 IS_SENSOR_B_HANDLE .set (segment , 0L , isSensorB );
213218 return this ;
214219 }
@@ -217,7 +222,7 @@ public boolean isSensorB() {
217222 return (boolean ) IS_SENSOR_B_HANDLE .get (segment , 0L );
218223 }
219224
220- public CharacterVirtualContact characterB (CharacterVirtual characterB ) {
225+ public CharacterContact characterB (CharacterVirtual characterB ) {
221226 CHARACTER_B_HANDLE .set (segment , 0L , characterB .memorySegment ());
222227 return this ;
223228 }
@@ -231,7 +236,7 @@ public CharacterVirtualContact characterB(CharacterVirtual characterB) {
231236 return new CharacterVirtual (segment );
232237 }
233238
234- public CharacterVirtualContact userData (long userData ) {
239+ public CharacterContact userData (long userData ) {
235240 USER_DATA_HANDLE .set (segment , 0L , userData );
236241 return this ;
237242 }
@@ -240,7 +245,7 @@ public long userData() {
240245 return (long ) USER_DATA_HANDLE .get (segment , 0L );
241246 }
242247
243- public CharacterVirtualContact material (PhysicsMaterial material ) {
248+ public CharacterContact material (PhysicsMaterial material ) {
244249 MATERIAL_HANDLE .set (segment , 0L , material .memorySegment ());
245250 return this ;
246251 }
@@ -254,7 +259,7 @@ public CharacterVirtualContact material(PhysicsMaterial material) {
254259 return new PhysicsMaterial (segment );
255260 }
256261
257- public CharacterVirtualContact hadCollision (boolean hadCollision ) {
262+ public CharacterContact hadCollision (boolean hadCollision ) {
258263 HAD_COLLISION_HANDLE .set (segment , 0L , hadCollision );
259264 return this ;
260265 }
@@ -263,7 +268,7 @@ public boolean hadCollision() {
263268 return (boolean ) HAD_COLLISION_HANDLE .get (segment , 0L );
264269 }
265270
266- public CharacterVirtualContact wasDiscarded (boolean wasDiscarded ) {
271+ public CharacterContact wasDiscarded (boolean wasDiscarded ) {
267272 WAS_DISCARDED_HANDLE .set (segment , 0L , wasDiscarded );
268273 return this ;
269274 }
@@ -272,7 +277,7 @@ public boolean wasDiscarded() {
272277 return (boolean ) WAS_DISCARDED_HANDLE .get (segment , 0L );
273278 }
274279
275- public CharacterVirtualContact canPushCharacter (boolean canPushCharacter ) {
280+ public CharacterContact canPushCharacter (boolean canPushCharacter ) {
276281 CAN_PUSH_CHARACTER_HANDLE .set (segment , 0L , canPushCharacter );
277282 return this ;
278283 }
@@ -281,12 +286,21 @@ public boolean canPushCharacter() {
281286 return (boolean ) CAN_PUSH_CHARACTER_HANDLE .get (segment , 0L );
282287 }
283288
284- public CharacterVirtualContact position (Consumer <Vec3 > consumer ) {
289+ public CharacterContact isBackFacingContact (boolean isBackFacingContact ) {
290+ IS_BACK_FACING_CONTACT_HANDLE .set (segment , 0L , isBackFacingContact );
291+ return this ;
292+ }
293+
294+ public boolean isBackFacingContact () {
295+ return (boolean ) IS_BACK_FACING_CONTACT_HANDLE .get (segment , 0L );
296+ }
297+
298+ public CharacterContact position (Consumer <Vec3 > consumer ) {
285299 consumer .accept (position );
286300 return this ;
287301 }
288302
289- public CharacterVirtualContact position (Vec3 other ) {
303+ public CharacterContact position (Vec3 other ) {
290304 position .set (other );
291305 return this ;
292306 }
@@ -295,12 +309,12 @@ public Vec3 position() {
295309 return position ;
296310 }
297311
298- public CharacterVirtualContact linearVelocity (Consumer <Vec3 > consumer ) {
312+ public CharacterContact linearVelocity (Consumer <Vec3 > consumer ) {
299313 consumer .accept (linearVelocity );
300314 return this ;
301315 }
302316
303- public CharacterVirtualContact linearVelocity (Vec3 other ) {
317+ public CharacterContact linearVelocity (Vec3 other ) {
304318 linearVelocity .set (other );
305319 return this ;
306320 }
@@ -309,12 +323,12 @@ public Vec3 linearVelocity() {
309323 return linearVelocity ;
310324 }
311325
312- public CharacterVirtualContact contactNormal (Consumer <Vec3 > consumer ) {
326+ public CharacterContact contactNormal (Consumer <Vec3 > consumer ) {
313327 consumer .accept (contactNormal );
314328 return this ;
315329 }
316330
317- public CharacterVirtualContact contactNormal (Vec3 other ) {
331+ public CharacterContact contactNormal (Vec3 other ) {
318332 contactNormal .set (other );
319333 return this ;
320334 }
@@ -323,12 +337,12 @@ public Vec3 contactNormal() {
323337 return contactNormal ;
324338 }
325339
326- public CharacterVirtualContact surfaceNormal (Consumer <Vec3 > consumer ) {
340+ public CharacterContact surfaceNormal (Consumer <Vec3 > consumer ) {
327341 consumer .accept (surfaceNormal );
328342 return this ;
329343 }
330344
331- public CharacterVirtualContact surfaceNormal (Vec3 other ) {
345+ public CharacterContact surfaceNormal (Vec3 other ) {
332346 surfaceNormal .set (other );
333347 return this ;
334348 }
@@ -338,12 +352,12 @@ public Vec3 surfaceNormal() {
338352 }
339353
340354 @ Override
341- public CharacterVirtualContact set (CharacterVirtualContact other ) {
355+ public CharacterContact set (CharacterContact other ) {
342356 return set (other .segment );
343357 }
344358
345359 @ Override
346- public CharacterVirtualContact set (MemorySegment src ) {
360+ public CharacterContact set (MemorySegment src ) {
347361 MemorySegment .copy (src , 0L , segment , 0L , LAYOUT .byteSize ());
348362 return this ;
349363 }
@@ -353,24 +367,24 @@ public MemorySegment memorySegment() {
353367 return segment ;
354368 }
355369
356- public NativeStructArray <CharacterVirtualContact > asArray () {
370+ public NativeStructArray <CharacterContact > asArray () {
357371 return new NativeStructArray <>(this );
358372 }
359373
360- public static NativeStructArray <CharacterVirtualContact > array (Arena arena , int count ) {
374+ public static NativeStructArray <CharacterContact > array (Arena arena , int count ) {
361375 return new NativeStructArray <>(
362376 arena ,
363377 LAYOUT ,
364- segment -> new CharacterVirtualContact (segment ),
378+ segment -> new CharacterContact (segment ),
365379 count
366380 );
367381 }
368382
369- public static NativeStructArray <CharacterVirtualContact > array (Arena arena , CharacterVirtualContact ... structs ) {
370- NativeStructArray <CharacterVirtualContact > array = new NativeStructArray <>(
383+ public static NativeStructArray <CharacterContact > array (Arena arena , CharacterContact ... structs ) {
384+ NativeStructArray <CharacterContact > array = new NativeStructArray <>(
371385 arena ,
372386 LAYOUT ,
373- segment -> new CharacterVirtualContact (segment ),
387+ segment -> new CharacterContact (segment ),
374388 structs .length
375389 );
376390
@@ -381,11 +395,11 @@ public static NativeStructArray<CharacterVirtualContact> array(Arena arena, Char
381395 return array ;
382396 }
383397
384- public static NativeStructArray <CharacterVirtualContact > array (MemorySegment array ) {
398+ public static NativeStructArray <CharacterContact > array (MemorySegment array ) {
385399 return new NativeStructArray <>(
386400 array ,
387401 LAYOUT ,
388- segment -> new CharacterVirtualContact (segment )
402+ segment -> new CharacterContact (segment )
389403 );
390404 }
391405
0 commit comments