Ghost collision improvements (#61)

- flag to disable hull-mesh speculative collision
- faster atomics #55 
- fix triangle vs hull logic
- fix #58 and #59
- improved shadows in samples app, a bit more expensive
This commit is contained in:
Erin Catto 2026-07-08 23:53:06 -07:00 • committed by GitHub
commit ef8ef0187a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
39 changed files with 16639 additions and 12086 deletions

View file

@ -102,7 +102,7 @@ typedef void b3LogFcn( const char* message );
B3_API void b3SetAllocator( b3AllocFcn* allocFcn, b3FreeFcn* freeFcn );
/// Total bytes allocated by Box3D
B3_API int32_t b3GetByteCount( void );
B3_API int b3GetByteCount( void );
/// Override the default assert callback.
/// @param assertFcn a non-null assert callback

View file

@ -616,7 +616,7 @@ B3_API void b3CollideCapsuleAndTriangle( b3LocalManifold* manifold, int capacity
/// Collide a hull and a triangle.
B3_API void b3CollideHullAndTriangle( b3LocalManifold* manifold, int capacity, const b3HullData* hullA, b3Vec3 v1, b3Vec3 v2,
b3Vec3 v3, int triangleFlags, b3SATCache* cache );
b3Vec3 v3, int triangleFlags, b3SATCache* cache, bool enableSpeculative );
/// Collide a sphere and a triangle.
B3_API void b3CollideSphereAndTriangle( b3LocalManifold* manifold, int capacity, const b3Sphere* sphereA,

View file

@ -511,6 +511,11 @@ typedef struct b3ShapeDef
/// Warning: if this is false, you MUST call b3Body_ApplyMassFromShapes or b3Body_SetMassData before simulating the world.
bool updateBodyMass;
/// Enable speculative collision. Leave this true unless you care about reducing ghost collision
/// more than continuous collision under rotation.
/// Experimental: this can only disable speculative contact between hulls and triangles (meshes and height fields).
bool enableSpeculativeContact;
/// Used internally to detect a valid definition. DO NOT SET.
int internalValue;