Bug fixes and minor features (#2)
- API to query compounds directly. - Fix some uninitialized stuff (thanks MSAN). - Fix for store impulses on overflow. - AABB margin reduced for small shapes - body contact recycling option - angular threshold for contact recycling - reduce AABB margin on smaller shapes - fix for hull vs tri when axis aligned - fully locked rotation uses zero inverse inertia
This commit is contained in:
parent
d7816a0a58
commit
7216822064
50 changed files with 759 additions and 360 deletions
16
src/solver.c
16
src/solver.c
|
|
@ -530,10 +530,6 @@ static void b3SolveContinuous( b3World* world, int bodySimIndex, b3TaskContext*
|
|||
const float speculativeScalar = B3_SPECULATIVE_DISTANCE;
|
||||
const b3Vec3 speculativeMargin = { speculativeScalar, speculativeScalar, speculativeScalar };
|
||||
|
||||
// todo implement per shape margin as in Box2D
|
||||
const float marginScalar = B3_AABB_MARGIN;
|
||||
const b3Vec3 aabbMargin = { marginScalar, marginScalar, marginScalar };
|
||||
|
||||
if ( context.fraction < 1.0f )
|
||||
{
|
||||
// Handle time of impact event
|
||||
|
|
@ -564,6 +560,8 @@ static void b3SolveContinuous( b3World* world, int bodySimIndex, b3TaskContext*
|
|||
|
||||
if ( b3AABB_Contains( shape->fatAABB, aabb ) == false )
|
||||
{
|
||||
float marginScalar = shape->aabbMargin;
|
||||
b3Vec3 aabbMargin = { marginScalar, marginScalar, marginScalar };
|
||||
shape->fatAABB = (b3AABB){ b3Sub( aabb.lowerBound, aabbMargin ), b3Add( aabb.upperBound, aabbMargin ) };
|
||||
|
||||
shape->enlargedAABB = true;
|
||||
|
|
@ -591,6 +589,8 @@ static void b3SolveContinuous( b3World* world, int bodySimIndex, b3TaskContext*
|
|||
|
||||
if ( b3AABB_Contains( shape->fatAABB, shape->aabb ) == false )
|
||||
{
|
||||
float marginScalar = shape->aabbMargin;
|
||||
b3Vec3 aabbMargin = { marginScalar, marginScalar, marginScalar };
|
||||
shape->fatAABB = (b3AABB){
|
||||
.lowerBound = b3Sub( shape->aabb.lowerBound, aabbMargin ),
|
||||
.upperBound = b3Add( shape->aabb.upperBound, aabbMargin ),
|
||||
|
|
@ -652,10 +652,6 @@ static void b3FinalizeBodiesTask( int startIndex, int endIndex, int workerIndex,
|
|||
const float speculativeScalar = B3_SPECULATIVE_DISTANCE;
|
||||
const b3Vec3 speculativeMargin = { speculativeScalar, speculativeScalar, speculativeScalar };
|
||||
|
||||
// todo per shape margin
|
||||
const float marginScalar = B3_AABB_MARGIN;
|
||||
const b3Vec3 aabbMargin = { marginScalar, marginScalar, marginScalar };
|
||||
|
||||
for ( int simIndex = startIndex; simIndex < endIndex; ++simIndex )
|
||||
{
|
||||
b3BodyState* state = states + simIndex;
|
||||
|
|
@ -715,7 +711,7 @@ static void b3FinalizeBodiesTask( int startIndex, int endIndex, int workerIndex,
|
|||
sim->flags &= ~( b3_isFast | b3_isSpeedCapped | b3_hadTimeOfImpact );
|
||||
state->flags &= ~( b3_isFast | b3_isSpeedCapped | b3_hadTimeOfImpact );
|
||||
|
||||
if ( enableSleep == false || body->enableSleep == false || sleepVelocity > body->sleepThreshold )
|
||||
if ( enableSleep == false || (body->flags & b3_enableSleep) == 0 || sleepVelocity > body->sleepThreshold )
|
||||
{
|
||||
// Body is not sleepy
|
||||
body->sleepTime = 0.0f;
|
||||
|
|
@ -805,6 +801,8 @@ static void b3FinalizeBodiesTask( int startIndex, int endIndex, int workerIndex,
|
|||
|
||||
if ( b3AABB_Contains( shape->fatAABB, aabb ) == false )
|
||||
{
|
||||
float marginScalar = shape->aabbMargin;
|
||||
b3Vec3 aabbMargin = { marginScalar, marginScalar, marginScalar };
|
||||
shape->fatAABB = (b3AABB){ b3Sub( aabb.lowerBound, aabbMargin ), b3Add( aabb.upperBound, aabbMargin ) };
|
||||
shape->enlargedAABB = true;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue