Box2D的:如何获取静态物体的位置? [英] Box2D: How to get the position of a static body?
本文介绍了Box2D的:如何获取静态物体的位置?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个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);
这篇关于Box2D的:如何获取静态物体的位置?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文