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:
parent
1bec63c9ee
commit
0f6fdad541
14 changed files with 94 additions and 30 deletions
|
|
@ -749,7 +749,7 @@ static void CreateTrees( b3WorldId worldId, int scale )
|
|||
|
||||
float velocityScale = 0.5f + ( 0.5f * bodyIndex ) / bodyCount;
|
||||
b3Body_ApplyMassFromShapes( bodyId );
|
||||
b3Pos center = b3Body_GetWorldCenterOfMass( bodyId );
|
||||
b3Pos center = b3Body_GetWorldCenter( bodyId );
|
||||
b3Vec3 omega = { 0.0f, 0.0f, velocityScale * angularVelocity };
|
||||
b3Vec3 v = b3Cross( omega, b3SubPos( center, bodyDef.position ) );
|
||||
b3Body_SetAngularVelocity( bodyId, omega );
|
||||
|
|
|
|||
Loading…
Reference in a new issue