我有一个box2d的世界与静态和动态体的混合物。在碰撞,我只能得到动态的的位置。
I have a Box2D world with a mixture of static and dynamic bodies. On collisions, I can only get the positions of the dynamic ones.
时有可能得到静态物体的位置?
Is it possible to get the positions of static objects?
NB,这是一个发展的previous问题的 Box2D的:?如何获取传感器的位置
N.b., this is a development of a previous question, Box2D: How to get the position of a sensor?
您可以使用下面的code得到的位置矢量:
You can get the position vector using the following code:
b2Transform t = body->GetTransform();
b2Vec2 pos = b2Vec2(t.p.x,t.p.y);