Box2D Get Bounding Box of a Body

转载自:http://gamedev.stackexchange.com/questions/1366/box2d-get-bounding-box-of-a-body

问题:

In Box2D, I was curious if it's possible to get a bounding box of a body already created in the world.

So basically, the Body is created, it's interacting with the world and such. And I needed that Body's bounding box. Is it possible?

答案:

In Box2D, bodies don't have bounding boxes associated with them, fixture do.

So you need to iterate over all the fixtures and generate a new AABB. Something like this:

你可能感兴趣的:(box2D)