Added a compile time option to use double precision body positions. Most
math remains single precision with minimal performance loss.

`BOX3D_DOUBLE_PRECISION`

Improved accuracy of body inertia computation when shapes are far from
the body origin.

WARNING: several APIs changed but migration should be straight forward
if doubles are not enabled.
This commit is contained in:
Erin Catto 2026-06-18 20:51:16 -07:00 • committed by GitHub
commit 09c65b08ea
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
115 changed files with 7591 additions and 5295 deletions

View file

@ -16,7 +16,7 @@ public:
{
if ( context->restart == false )
{
m_camera->SetView( 45.0f, 30.0f, 6.0f, b3Vec3_zero );
m_camera->SetView( 45.0f, 30.0f, 6.0f, b3Pos_zero );
}
AddGroundBox( 20.0f );
@ -86,7 +86,7 @@ public:
{
if ( context->restart == false )
{
m_camera->SetView( 45.0f, 30.0f, 6.0f, b3Vec3_zero );
m_camera->SetView( 45.0f, 30.0f, 6.0f, b3Pos_zero );
}
{
@ -221,7 +221,7 @@ public:
{
if ( context->restart == false )
{
m_camera->SetView( 180.0f, 30.0f, 20.0f, b3Vec3_zero );
m_camera->SetView( 180.0f, 30.0f, 20.0f, b3Pos_zero );
}
b3BodyDef bodyDef = b3DefaultBodyDef();
@ -234,7 +234,7 @@ public:
for ( int i = 0; i < e_count; ++i )
{
b3Vec3 position = { 0.1f * i, 2.0f + 0.5f * i, -0.1f * i };
b3Pos position = { 0.1f * i, 2.0f + 0.5f * i, -0.1f * i };
float torque = 10.0f;
float hertz = 0.5f;
float damping = 0.7f;
@ -269,7 +269,7 @@ public:
{
if ( m_context->restart == false )
{
m_camera->SetView( -20.0f, 30.0f, 25.0f, b3Vec3_zero );
m_camera->SetView( -20.0f, 30.0f, 25.0f, b3Pos_zero );
}
b3ShapeDef shapeDef = b3DefaultShapeDef();
@ -292,7 +292,7 @@ public:
}
m_human = {};
b3Vec3 position = { -12.0f, 6.0f, 0.0f };
b3Pos position = { -12.0f, 6.0f, 0.0f };
float torque = 10.0f;
float hertz = 2.0f;
float damping = 0.7f;