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?
注意,这是上一个问题的发展,Box2D:如何获取传感器的位置?
N.b., this is a development of a previous question, Box2D: How to get the position of a sensor?
推荐答案
我找到了办法——在碰撞中,AABB的中心会给位置
I found a way - in the collision, the center of the AABB will give the position
contact.GetFixtureA().GetAABB().GetCenter()
这篇关于Box2D:如何获取静态物体的位置?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文