b3GetFixedSolverSet

This commit is contained in:
Erin Catto 2026-11-11 17:11:51 -08:00
commit 66450f0ebf
12 changed files with 27 additions and 21 deletions

View file

@ -183,7 +183,7 @@ void b3CreateContact( b3World* world, b3Shape* shapeA, b3Shape* shapeB, int chil
setIndex = b3_disabledSet;
}
b3SolverSet* set = b3GetSolverSet( world, setIndex );
b3SolverSet* set = b3GetFixedSolverSet( world, setIndex );
// Create contact key and contact
int contactId = b3AllocId( &world->contactIdPool );

View file

@ -256,8 +256,8 @@ void b3PrepareDistanceJoint( b3JointSim* base, b3StepContext* context )
B3_ASSERT( bodyA->setIndex == b3_awakeSet || bodyB->setIndex == b3_awakeSet );
b3SolverSet* setA = b3GetSolverSet( world, bodyA->setIndex );
b3SolverSet* setB = b3GetSolverSet( world, bodyB->setIndex );
b3SolverSet* setA = b3GetFixedSolverSet( world, bodyA->setIndex );
b3SolverSet* setB = b3GetFixedSolverSet( world, bodyB->setIndex );
int localIndexA = bodyA->localIndex;
int localIndexB = bodyB->localIndex;

View file

@ -193,8 +193,8 @@ void b3PrepareMotorJoint( b3JointSim* base, b3StepContext* context )
B3_ASSERT( bodyA->setIndex == b3_awakeSet || bodyB->setIndex == b3_awakeSet );
b3SolverSet* setA = b3GetSolverSet( world, bodyA->setIndex );
b3SolverSet* setB = b3GetSolverSet( world, bodyB->setIndex );
b3SolverSet* setA = b3GetFixedSolverSet( world, bodyA->setIndex );
b3SolverSet* setB = b3GetFixedSolverSet( world, bodyB->setIndex );
int localIndexA = bodyA->localIndex;
int localIndexB = bodyB->localIndex;

View file

@ -65,8 +65,8 @@ void b3PrepareMoverJoint( b3JointSim* base, b3StepContext* context )
B3_ASSERT( bodyA->setIndex == b3_awakeSet || bodyB->setIndex == b3_awakeSet );
b3SolverSet* setA = b3GetSolverSet( world, bodyA->setIndex );
b3SolverSet* setB = b3GetSolverSet( world, bodyB->setIndex );
b3SolverSet* setA = b3GetFixedSolverSet( world, bodyA->setIndex );
b3SolverSet* setB = b3GetFixedSolverSet( world, bodyB->setIndex );
int localIndexA = bodyA->localIndex;
int localIndexB = bodyB->localIndex;

View file

@ -81,8 +81,8 @@ void b3PrepareParallelJoint( b3JointSim* base, b3StepContext* context )
b3Body* bodyB = b3Array_Get( world->bodies, base->bodyIdB );
B3_ASSERT( bodyA->setIndex == b3_awakeSet || bodyB->setIndex == b3_awakeSet );
b3SolverSet* setA = b3GetSolverSet( world, bodyA->setIndex );
b3SolverSet* setB = b3GetSolverSet( world, bodyB->setIndex );
b3SolverSet* setA = b3GetFixedSolverSet( world, bodyA->setIndex );
b3SolverSet* setB = b3GetFixedSolverSet( world, bodyB->setIndex );
int localIndexA = bodyA->localIndex;
int localIndexB = bodyB->localIndex;

View file

@ -312,6 +312,12 @@ static inline b3SolverSet* b3GetSolverSet( b3World* world, int setIndex )
return b3Array_Get( world->sleepingSets, setIndex - b3_firstSleepingSet );
}
static inline b3SolverSet* b3GetFixedSolverSet( b3World* world, int setIndex )
{
B3_ASSERT( 0 <= setIndex && setIndex < b3_firstSleepingSet );
return world->fixedSets + setIndex;
}
static inline int b3GetSolverSetCount( const b3World* world )
{
return b3_firstSleepingSet + world->sleepingSets.count;

View file

@ -184,8 +184,8 @@ void b3PreparePogoJoint( b3JointSim* base, b3StepContext* context )
B3_ASSERT( bodyA->setIndex == b3_awakeSet || bodyB->setIndex == b3_awakeSet );
b3SolverSet* setA = b3GetSolverSet( world, bodyA->setIndex );
b3SolverSet* setB = b3GetSolverSet( world, bodyB->setIndex );
b3SolverSet* setA = b3GetFixedSolverSet( world, bodyA->setIndex );
b3SolverSet* setB = b3GetFixedSolverSet( world, bodyB->setIndex );
int localIndexA = bodyA->localIndex;
int localIndexB = bodyB->localIndex;

View file

@ -308,8 +308,8 @@ void b3PreparePrismaticJoint( b3JointSim* base, b3StepContext* context )
b3Body* bodyB = b3Array_Get( world->bodies, base->bodyIdB );
B3_ASSERT( bodyA->setIndex == b3_awakeSet || bodyB->setIndex == b3_awakeSet );
b3SolverSet* setA = b3GetSolverSet( world, bodyA->setIndex );
b3SolverSet* setB = b3GetSolverSet( world, bodyB->setIndex );
b3SolverSet* setA = b3GetFixedSolverSet( world, bodyA->setIndex );
b3SolverSet* setB = b3GetFixedSolverSet( world, bodyB->setIndex );
int localIndexA = bodyA->localIndex;
int localIndexB = bodyB->localIndex;

View file

@ -267,8 +267,8 @@ void b3PrepareRevoluteJoint( b3JointSim* base, b3StepContext* context )
b3Body* bodyB = b3Array_Get( world->bodies, base->bodyIdB );
B3_ASSERT( bodyA->setIndex == b3_awakeSet || bodyB->setIndex == b3_awakeSet );
b3SolverSet* setA = b3GetSolverSet( world, bodyA->setIndex );
b3SolverSet* setB = b3GetSolverSet( world, bodyB->setIndex );
b3SolverSet* setA = b3GetFixedSolverSet( world, bodyA->setIndex );
b3SolverSet* setB = b3GetFixedSolverSet( world, bodyB->setIndex );
int localIndexA = bodyA->localIndex;
int localIndexB = bodyB->localIndex;

View file

@ -301,8 +301,8 @@ void b3PrepareSphericalJoint( b3JointSim* base, b3StepContext* context )
b3Body* bodyB = b3Array_Get( world->bodies, base->bodyIdB );
B3_ASSERT( bodyA->setIndex == b3_awakeSet || bodyB->setIndex == b3_awakeSet );
b3SolverSet* setA = b3GetSolverSet( world, bodyA->setIndex );
b3SolverSet* setB = b3GetSolverSet( world, bodyB->setIndex );
b3SolverSet* setA = b3GetFixedSolverSet( world, bodyA->setIndex );
b3SolverSet* setB = b3GetFixedSolverSet( world, bodyB->setIndex );
int localIndexA = bodyA->localIndex;
int localIndexB = bodyB->localIndex;

View file

@ -92,8 +92,8 @@ void b3PrepareWeldJoint( b3JointSim* base, b3StepContext* context )
b3Body* bodyB = b3Array_Get( world->bodies, base->bodyIdB );
B3_ASSERT( bodyA->setIndex == b3_awakeSet || bodyB->setIndex == b3_awakeSet );
b3SolverSet* setA = b3GetSolverSet( world, bodyA->setIndex );
b3SolverSet* setB = b3GetSolverSet( world, bodyB->setIndex );
b3SolverSet* setA = b3GetFixedSolverSet( world, bodyA->setIndex );
b3SolverSet* setB = b3GetFixedSolverSet( world, bodyB->setIndex );
int localIndexA = bodyA->localIndex;
int localIndexB = bodyB->localIndex;

View file

@ -416,8 +416,8 @@ void b3PrepareWheelJoint( b3JointSim* base, b3StepContext* context )
b3Body* bodyB = b3Array_Get( world->bodies, idB );
B3_ASSERT( bodyA->setIndex == b3_awakeSet || bodyB->setIndex == b3_awakeSet );
b3SolverSet* setA = b3GetSolverSet( world, bodyA->setIndex );
b3SolverSet* setB = b3GetSolverSet( world, bodyB->setIndex );
b3SolverSet* setA = b3GetFixedSolverSet( world, bodyA->setIndex );
b3SolverSet* setB = b3GetFixedSolverSet( world, bodyB->setIndex );
int localIndexA = bodyA->localIndex;
int localIndexB = bodyB->localIndex;