Skip to content

Commit

Permalink
try03
Browse files Browse the repository at this point in the history
  • Loading branch information
erincatto committed Aug 27, 2024
1 parent d7ab203 commit 3c733cd
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion samples/sample_determinism.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,22 @@ class FallingHinges : public Sample

m_hash = 0;
m_sleepStep = -1;

PrintTransforms();
}

void PrintTransforms()
{
uint32_t hash = B2_HASH_INIT;
int bodyCount = e_rows * e_columns;
for ( int i = 0; i < bodyCount; ++i )
{
b2Transform xf = b2Body_GetTransform( m_bodies[i] );
printf( "%d %.9f %.9f %.9f %.9f\n", i, xf.p.x, xf.p.y, xf.q.c, xf.q.s );
hash = b2Hash( hash, reinterpret_cast<uint8_t*>( &xf ), sizeof( b2Transform ) );
}

printf( "hash = 0x%08x\n", hash );
}

void Step(Settings& settings) override
Expand All @@ -127,7 +143,7 @@ class FallingHinges : public Sample
}
}

//if (sleeping == true)
if (sleeping == true)
{
uint32_t hash = B2_HASH_INIT;
for ( int i = 0; i < bodyCount; ++i )
Expand Down

0 comments on commit 3c733cd

Please sign in to comment.