diff --git a/src/manifold.h b/src/manifold.h index 0dcd8a9..5b8f550 100644 --- a/src/manifold.h +++ b/src/manifold.h @@ -55,7 +55,7 @@ void b3BuildTriangleAndCapsuleFaceContact( b3LocalManifold* manifold, const b3Ve const b3Capsule* capsule ); void b3BuildTriangleAndHullFaceContact( b3LocalManifold* manifold, int capacity, const b3Vec3* triangle, int triangleFlags, - const b3HullData* hull, bool enableSpeculative ); + const b3HullData* hull, b3SATCache* cache, bool enableSpeculative ); b3AxisQuery b3ComputeSeparatingAxisW4( const b3HullData* hullA, const b3HullData* hullB, b3Transform xfB, bool earlyReturn ); b3AxisQuery b3ComputeSeparatingAxisW8( const b3HullData* hullA, const b3HullData* hullB, b3Transform xfB, bool earlyReturn ); diff --git a/src/mesh_contact.c b/src/mesh_contact.c index c3e197a..d34fdc4 100644 --- a/src/mesh_contact.c +++ b/src/mesh_contact.c @@ -1088,8 +1088,8 @@ bool b3ComputeMeshManifolds( b3World* world, int workerIndex, b3Contact* contact } else if ( result == b3_neighborSnap && shapeB->type == b3_hullShape ) { - b3BuildTriangleAndHullFaceContact( manifold, pointCapacity, vertices, - triangle.flags, hullB, enableSpeculative ); + b3BuildTriangleAndHullFaceContact( manifold, pointCapacity, vertices, triangle.flags, hullB, + &cache->satCache, enableSpeculative ); if ( keepDeep && manifold->pointCount == 0 ) { diff --git a/src/triangle_manifold.c b/src/triangle_manifold.c index ab77d37..c3bb1f5 100644 --- a/src/triangle_manifold.c +++ b/src/triangle_manifold.c @@ -955,7 +955,7 @@ static void b3CollideTriangleAndHullEdges( b3LocalManifold* manifold, int capaci // Triangle face contact wrapper. void b3BuildTriangleAndHullFaceContact( b3LocalManifold* manifold, int capacity, const b3Vec3* triangle, int triangleFlags, - const b3HullData* hull, bool enableSpeculative ) + const b3HullData* hull, b3SATCache* cache, bool enableSpeculative ) { manifold->pointCount = 0; @@ -971,8 +971,13 @@ void b3BuildTriangleAndHullFaceContact( b3LocalManifold* manifold, int capacity, }; b3SeparatingAxis query = b3QueryTriangleFace( &triangleData, hull ); - b3SATCache cache = { 0 }; - b3CollideTriangleFace( manifold, capacity, &triangleData, hull, query, &cache, enableSpeculative ); + b3SATCache faceCache = { 0 }; + b3CollideTriangleFace( manifold, capacity, &triangleData, hull, query, &faceCache, enableSpeculative ); + + if ( manifold->pointCount > 0 ) + { + *cache = faceCache; + } } b3AtomicInt b3_triangleConvexCalls; diff --git a/test/test_determinism.c b/test/test_determinism.c index e71f5d2..4fbfd30 100644 --- a/test/test_determinism.c +++ b/test/test_determinism.c @@ -32,14 +32,14 @@ #else #define RAGDOLL_SLEEP_STEP 289 #define RAGDOLL_HASH 0xF290ED4B -#define WAVE_PILE_SLEEP_STEP 291 -#define WAVE_PILE_HASH 0x3137D79A +#define WAVE_PILE_SLEEP_STEP 296 +#define WAVE_PILE_HASH 0x8A4A5802 #define QUERY_SPAWN_SLEEP_STEP 242 #define QUERY_SPAWN_HASH 0xF3AD9BA6 #define QUERY_SPAWN_HIT_COUNT 59 #define QUERY_SPAWN_QUERY_HASH 0xE3271F3D #define MESH_DROP_SLEEP_STEP 197 -#define MESH_DROP_HASH 0xA4184C4B +#define MESH_DROP_HASH 0x70483620 #endif // The goldens above pin exact values for the default four point manifold. A build that