account for hull face

This commit is contained in:
Erin Catto 2026-10-31 12:12:33 -07:00
commit 18d3b54761
3 changed files with 25 additions and 14 deletions

View file

@ -28,7 +28,7 @@ cliff,0,1,box,0,2
cliff,0,1,capsule,0,2
cliff,0,1,upright,0,2
cliff,0,1,sphere,0,2
cliff,0,1,cylinder,2,2
cliff,0,1,cylinder,0,2
crest,0,0,box,0,2
crest,0,0,capsule,0,2
crest,0,0,upright,0,2
@ -44,26 +44,26 @@ bumps,0,0,capsule,0,1
bumps,0,0,upright,0,1
bumps,0,0,sphere,0,1
bumps,0,0,cylinder,0,1
bumps,0,1,box,0,0
bumps,0,1,box,0,1
bumps,0,1,capsule,0,1
bumps,0,1,upright,0,1
bumps,0,1,sphere,0,1
bumps,0,1,cylinder,0,0
bumps,0,1,cylinder,0,1
tjunction,0,0,box,0,2
tjunction,0,0,capsule,0,2
tjunction,0,0,upright,0,2
tjunction,0,0,sphere,0,2
tjunction,0,0,cylinder,9,2
tjunction,0,0,cylinder,6,2
tjunction,0,1,box,0,2
tjunction,0,1,capsule,0,2
tjunction,0,1,upright,0,2
tjunction,0,1,sphere,0,2
tjunction,0,1,cylinder,0,2
seam,0,0,box,4,1
seam,0,0,box,2,1
seam,0,0,capsule,0,2
seam,0,0,upright,0,2
seam,0,0,sphere,0,2
seam,0,0,cylinder,6,1
seam,0,0,cylinder,4,1
seam,0,1,box,0,2
seam,0,1,capsule,0,2
seam,0,1,upright,0,2
@ -93,12 +93,12 @@ peel,2,0,box,0,2
peel,2,0,capsule,0,2
peel,2,0,upright,0,2
peel,2,0,sphere,0,2
peel,2,0,cylinder,6,2
peel,2,0,cylinder,4,1
peel,2,1,box,0,2
peel,2,1,capsule,0,2
peel,2,1,upright,0,2
peel,2,1,sphere,0,2
peel,2,1,cylinder,2,2
peel,2,1,cylinder,0,2
peel,3,0,box,0,2
peel,3,0,capsule,0,2
peel,3,0,upright,0,2

1 scene preset mirror body ghosts runs
28 cliff 0 1 capsule 0 2
29 cliff 0 1 upright 0 2
30 cliff 0 1 sphere 0 2
31 cliff 0 1 cylinder 2 0 2
32 crest 0 0 box 0 2
33 crest 0 0 capsule 0 2
34 crest 0 0 upright 0 2
44 bumps 0 0 upright 0 1
45 bumps 0 0 sphere 0 1
46 bumps 0 0 cylinder 0 1
47 bumps 0 1 box 0 0 1
48 bumps 0 1 capsule 0 1
49 bumps 0 1 upright 0 1
50 bumps 0 1 sphere 0 1
51 bumps 0 1 cylinder 0 0 1
52 tjunction 0 0 box 0 2
53 tjunction 0 0 capsule 0 2
54 tjunction 0 0 upright 0 2
55 tjunction 0 0 sphere 0 2
56 tjunction 0 0 cylinder 9 6 2
57 tjunction 0 1 box 0 2
58 tjunction 0 1 capsule 0 2
59 tjunction 0 1 upright 0 2
60 tjunction 0 1 sphere 0 2
61 tjunction 0 1 cylinder 0 2
62 seam 0 0 box 4 2 1
63 seam 0 0 capsule 0 2
64 seam 0 0 upright 0 2
65 seam 0 0 sphere 0 2
66 seam 0 0 cylinder 6 4 1
67 seam 0 1 box 0 2
68 seam 0 1 capsule 0 2
69 seam 0 1 upright 0 2
93 peel 2 0 capsule 0 2
94 peel 2 0 upright 0 2
95 peel 2 0 sphere 0 2
96 peel 2 0 cylinder 6 4 2 1
97 peel 2 1 box 0 2
98 peel 2 1 capsule 0 2
99 peel 2 1 upright 0 2
100 peel 2 1 sphere 0 2
101 peel 2 1 cylinder 2 0 2
102 peel 3 0 box 0 2
103 peel 3 0 capsule 0 2
104 peel 3 0 upright 0 2

View file

@ -666,26 +666,37 @@ static b3NeighborResult b3TestHullFaceNeighbors( const b3Shape* shape, int trian
float linearSlop = B3_LINEAR_SLOP;
int nearEdges[3];
int nearCount = 0;
bool inwardTilt = false;
bool alongEdge = false;
for ( int i = 0; i < 3; ++i )
{
b3Vec3 vertex = vertices[i];
b3Vec3 edge = b3Sub( vertices[i < 2 ? i + 1 : 0], vertex );
b3Vec3 inward = b3Normalize( b3Cross( triangleNormal, edge ) );
b3Vec3 edge = b3Normalize( b3Sub( vertices[i < 2 ? i + 1 : 0], vertex ) );
b3Vec3 inward = b3Cross( triangleNormal, edge );
if ( b3Dot( inward, b3Sub( point, vertex ) ) <= linearSlop )
{
nearEdges[nearCount] = i;
nearCount += 1;
// An edge or vertex normal cone tilts outward from the triangle and an edge cone is perpendicular to the edge, a hull face normal need be neither.
inwardTilt = inwardTilt || b3Dot( normal, inward ) > tolerance;
alongEdge = alongEdge || b3AbsFloat( b3Dot( normal, edge ) ) > tolerance;
}
}
b3TriangleFeature feature;
if ( nearCount == 0 )
if ( nearCount == 0 || inwardTilt )
{
// A tilted hull face over the triangle interior, the triangle face owns the normal.
return b3_neighborSnap;
}
else if ( nearCount == 1 )
{
if ( alongEdge )
{
return b3_neighborSnap;
}
b3TriangleFeature edgeFeatures[3] = { b3_featureEdge1, b3_featureEdge2, b3_featureEdge3 };
feature = edgeFeatures[nearEdges[0]];
}

View file

@ -32,14 +32,14 @@
#else
#define RAGDOLL_SLEEP_STEP 346
#define RAGDOLL_HASH 0x27E7E059
#define WAVE_PILE_SLEEP_STEP 309
#define WAVE_PILE_HASH 0xC57E6388
#define WAVE_PILE_SLEEP_STEP 328
#define WAVE_PILE_HASH 0x865EC3F3
#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 0xA498DD53
#define MESH_DROP_HASH 0xD30DB1AE
#endif
// The goldens above pin exact values for the default four point manifold. A build that