clockwise option, joint is awake (#130)

- b3MeshDef gets stride and clockwise option
- Added b3Joint_IsAwake
- Added b3Body_TimeOfImpactMover
- #116
- Smoother mover collision: #141
- Shape casts now ignore backside collision on mesh and height-field
triangles, same as ray casts.
This commit is contained in:
Erin Catto 2026-08-29 21:47:53 -07:00 • committed by GitHub
commit 47d7f7cc7e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
35 changed files with 2466 additions and 303 deletions

View file

@ -778,7 +778,7 @@ b3ShapeExtent b3ComputeShapeExtent( const b3Shape* shape, b3Vec3 localCenter )
b3Vec3 c1 = b3Sub( shape->capsule.center1, localCenter );
b3Vec3 c2 = b3Sub( shape->capsule.center2, localCenter );
b3Vec3 r = { radius, radius, radius };
extent.maxExtent = b3Add( b3Max( c1, c2 ), r );
extent.maxExtent = b3Add( b3Max( b3Abs( c1 ), b3Abs( c2 ) ), r );
}
break;
@ -798,9 +798,9 @@ b3ShapeExtent b3ComputeShapeExtent( const b3Shape* shape, b3Vec3 localCenter )
{
float radius = shape->sphere.radius;
extent.minExtent = radius;
b3Vec3 h = b3Abs( b3Sub( shape->sphere.center, localCenter ) );
b3Vec3 r = { radius, radius, radius };
b3Vec3 p = b3Add( b3Sub( shape->sphere.center, localCenter ), r );
extent.maxExtent = b3Abs( b3Sub( p, localCenter ) );
extent.maxExtent = b3Add( h, r );
}
break;
@ -816,7 +816,7 @@ b3ShapeExtent b3ComputeShapeExtent( const b3Shape* shape, b3Vec3 localCenter )
float r2 = b3Length( b3Sub( aabb.upperBound, localCenter ) );
extent.minExtent = b3MinFloat( r1, r2 );
b3Vec3 p = b3FarthestPointOnAABB( aabb, localCenter );
extent.maxExtent = b3Abs( p );
extent.maxExtent = b3Abs( b3Sub( p, localCenter ) );
}
break;
@ -939,32 +939,6 @@ bool b3OverlapShape( const b3Shape* shape, b3Transform transform, const b3ShapeP
B3_ASSERT( false );
return false;
}
#if 0
b3Vec3 localPoints[B3_MAX_SHAPE_CAST_POINTS];
b3ShapeProxy localProxy;
b3Transform invTransform = b3InvertTransform( transform );
b3Matrix3 R = b3MakeMatrixFromQuat( invTransform.q );
localProxy.count = b3MinInt( proxy->count, B3_MAX_SHAPE_CAST_POINTS );
for ( int i = 0; i < localProxy.count; ++i )
{
localPoints[i] = b3Add( b3MulMV( R, proxy->points[i] ), invTransform.p );
}
localProxy.points = localPoints;
localProxy.radius = proxy->radius;
if ( type == b3_meshShape )
{
return b3OverlapMesh( &localProxy, shape->mesh.data, shape->mesh.scale );
}
B3_ASSERT( type == b3_heightShape );
return b3OverlapHeightField( &localProxy, shape->heightField );
#endif
}
int b3CollideMover( b3PlaneResult* planes, int planeCapacity, const b3Shape* shape, b3Transform transform,
@ -1016,6 +990,7 @@ int b3CollideMover( b3PlaneResult* planes, int planeCapacity, const b3Shape* sha
{
planes[i].plane.normal = b3RotateVector( transform.q, planes[i].plane.normal );
planes[i].point = b3TransformPoint( transform, planes[i].point );
planes[i].materialIndex = b3ClampInt( planes[i].materialIndex, 0, shape->materialCount - 1 );
}
return planeCount;