Distance between objects affected by gravity

How would I find the distance between two objects affected by gravity? I have looked at the DistanceTest Testbed example, and it seems those are just static objects. I want to be able to calculate the distance between my player and some platforms.

Thanks 🙂
Just grab the shapes off the bodies and call b2Distance as shown in the example.

You can maintain the simplex cache to improve the performance of repeated calls.
Erin Catto wrote:
Just grab the shapes off the bodies and call b2Distance as shown in the example.

You can maintain the simplex cache to improve the performance of repeated calls.

Hmm I don't see a method to return the shape, here is what I have so far, is it the correct way to create a player?

globally defined:
Code:
b2Body* m_player;


Code:
b2BodyDef bd;
bd.type = b2_dynamicBody;
bd.position.Set(10.0f, 5.0f);
m_player = m_world->CreateBody(&bd);

b2PolygonShape shape1;
shape1.SetAsBox(2.0f, 2.0f);

b2FixtureDef fd;
fd.shape = &shape1;
fd.friction = 10.0f;
fd.density = 1000.0f;
m_player->CreateFixture(&fd);



Then I want to do something along the lines of, from the example
Code:
b2DistanceInput input;
//input.proxyA.Set(&?????);
//input.proxyB.Set(&?????);
input.useRadii = true;
b2SimplexCache cache;
cache.count = 0;
b2DistanceOutput output;
b2Distance(&output, &cache, &input);

m_debugDraw.DrawString(5, m_textLine, "distance = %g", output.distance);

Original thread: https://box2d.org/forum/viewtopic.php?t=4801