Sync body flags (#7)

- Fixed mesh point culling for vertically stacked points
- Fixed two point capsule vs capsule normal
- Fixed bug where body flags can go out of sync
- Added tests
- Updated benchmarks
This commit is contained in:
Erin Catto 2026-05-16 23:27:25 -07:00 • committed by GitHub
commit 79cc160275
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
39 changed files with 1686 additions and 931 deletions

View file

@ -914,7 +914,7 @@ public:
bodyDef.name = "angular xz";
bodyDef.position = { 2.0f, 2.0f, 0.0f };
bodyDef.motionLocks.angularX = true;
//bodyDef.motionLocks.angularY = true;
// bodyDef.motionLocks.angularY = true;
bodyDef.motionLocks.angularZ = true;
b3BodyId bodyId = b3CreateBody( m_worldId, &bodyDef );
b3CreateHullShape( bodyId, &shapeDef, &cube.base );
@ -963,3 +963,61 @@ public:
};
static int sampleLockMixing = SampleManager::Register( "Bodies", "Lock Mixing", LockMixing::Create );
// A fully rotation locked body uses a zero inverse inertia tensor
class FixedRotation : public Sample
{
public:
explicit FixedRotation( SampleContext* context )
: Sample( context )
{
if ( context->restart == false )
{
m_camera->SetView( 0.0f, 15.0f, 10.0f, b3Vec3_zero );
}
{
b3BodyDef bodyDef = b3DefaultBodyDef();
bodyDef.position = { 0.0f, -1.0f, 0.0f };
b3BodyId groundId = b3CreateBody( m_worldId, &bodyDef );
b3ShapeDef shapeDef = b3DefaultShapeDef();
b3BoxHull hull = b3MakeBoxHull( 15.0f, 1.0f, 15.0f );
b3CreateHullShape( groundId, &shapeDef, &hull.base );
}
b3Capsule capsule = { { 0.0f, 0.0f, 0.0f }, { 0.0f, 1.0f, 0.0f }, 0.3f };
b3ShapeDef shapeDef = b3DefaultShapeDef();
{
b3BodyDef bodyDef = b3DefaultBodyDef();
bodyDef.position = { 0.0f, 0.5f, 0.0f };
b3BodyId bodyId = b3CreateBody( m_worldId, &bodyDef );
b3CreateCapsuleShape( bodyId, &shapeDef, &capsule );
}
{
b3BodyDef bodyDef = b3DefaultBodyDef();
bodyDef.position = { 0.3f, 0.5f, 0.0f };
bodyDef.type = b3_dynamicBody;
bodyDef.gravityScale = 0.0f;
bodyDef.enableSleep = false;
bodyDef.motionLocks.angularX = true;
bodyDef.motionLocks.angularY = true;
bodyDef.motionLocks.angularZ = true;
capsule.radius = 0.2f;
b3BodyId bodyId = b3CreateBody( m_worldId, &bodyDef );
b3CreateCapsuleShape( bodyId, &shapeDef, &capsule );
}
}
static Sample* Create( SampleContext* context )
{
return new FixedRotation( context );
}
};
static int sampleFixedRotation = SampleManager::Register( "Bodies", "Fixed Rotation", FixedRotation::Create );