Gyro tolerance (#191)

This commit is contained in:
Erin Catto 2026-10-15 23:30:56 -07:00 • committed by GitHub
commit efca0c184d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
23 changed files with 420 additions and 63 deletions

View file

@ -332,6 +332,7 @@ b3WorldId b3CreateWorld( const b3WorldDef* def )
world->restitutionIterations = b3ClampInt( def->restitutionIterations, 0, B3_MAX_RESTITUTION_ITERATIONS );
world->enableRestitutionPropagation = def->enableRestitutionPropagation;
world->maxLinearSpeed = def->maximumLinearSpeed;
world->isotropicInertiaTolerance = b3ClampFloat( def->isotropicInertiaTolerance, 0.0f, 1.0f );
world->contactSpeed = def->contactSpeed;
world->contactHertz = def->contactHertz;
world->contactDampingRatio = def->contactDampingRatio;
@ -2215,6 +2216,27 @@ float b3World_GetMaximumLinearSpeed( b3WorldId worldId )
return world->maxLinearSpeed;
}
void b3World_SetIsotropicInertiaTolerance( b3WorldId worldId, float tolerance )
{
B3_ASSERT( b3IsValidFloat( tolerance ) );
b3World* world = b3GetUnlockedWorldFromId( worldId );
if ( world == NULL )
{
return;
}
B3_REC( world, WorldSetIsotropicInertiaTolerance, worldId, tolerance );
world->isotropicInertiaTolerance = b3ClampFloat( tolerance, 0.0f, 1.0f );
}
float b3World_GetIsotropicInertiaTolerance( b3WorldId worldId )
{
b3World* world = b3GetWorldFromId( worldId );
return world->isotropicInertiaTolerance;
}
b3Profile b3World_GetProfile( b3WorldId worldId )
{
b3World* world = b3GetUnlockedWorldFromId( worldId );