Set mass data consistent velocity (#45)

- Rename b3Body_GetWorldCenterOfMass to b3Body_GetWorldCenter.
- Rename b3Body_GetLocalCenterOfMass to b3Body_GetLocalCenter.
- Fixed b3Body_SetMassData to correct velocity when local center moves.
This commit is contained in:
Erin Catto 2026-07-04 11:22:29 -07:00 • committed by GitHub
commit 0f6fdad541
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
14 changed files with 94 additions and 30 deletions

View file

@ -938,7 +938,7 @@ public:
int count = b3Body_GetContactData( body, contacts, capacity );
for ( int i = 0; i < count; ++i )
{
b3Pos originA = b3Body_GetWorldCenterOfMass( b3Shape_GetBody( contacts[i].shapeIdA ) );
b3Pos originA = b3Body_GetWorldCenter( b3Shape_GetBody( contacts[i].shapeIdA ) );
for ( int m = 0; m < contacts[i].manifoldCount; ++m )
{
const b3Manifold* manifold = &contacts[i].manifolds[m];
@ -965,7 +965,7 @@ public:
}
b3BodyId body = b3Shape_GetBody( shape );
DrawAxes( b3Body_GetTransform( body ), 0.5f );
DrawPoint( b3Body_GetWorldCenterOfMass( body ), 8.0f, MakeColor( b3_colorYellow ) );
DrawPoint( b3Body_GetWorldCenter( body ), 8.0f, MakeColor( b3_colorYellow ) );
DrawBodyContacts( body );
}
else if ( m_selKind == SelBody )
@ -976,7 +976,7 @@ public:
return;
}
DrawAxes( b3Body_GetTransform( body ), 0.5f );
DrawPoint( b3Body_GetWorldCenterOfMass( body ), 8.0f, MakeColor( b3_colorYellow ) );
DrawPoint( b3Body_GetWorldCenter( body ), 8.0f, MakeColor( b3_colorYellow ) );
DrawBodyContacts( body );
}
else if ( m_selKind == SelJoint )
@ -990,11 +990,11 @@ public:
b3BodyId b = b3Joint_GetBodyB( joint );
if ( b3Body_IsValid( a ) )
{
DrawPoint( b3Body_GetWorldCenterOfMass( a ), 8.0f, MakeColor( b3_colorMagenta ) );
DrawPoint( b3Body_GetWorldCenter( a ), 8.0f, MakeColor( b3_colorMagenta ) );
}
if ( b3Body_IsValid( b ) )
{
DrawPoint( b3Body_GetWorldCenterOfMass( b ), 8.0f, MakeColor( b3_colorMagenta ) );
DrawPoint( b3Body_GetWorldCenter( b ), 8.0f, MakeColor( b3_colorMagenta ) );
}
}
}