简体   繁体   English

Farseer Physics Bodies In Touch(in contact)

[英]Farseer Physics Bodies In touch (in contact)

I am new to Farseer, developing a xna + Farseer physics game. 我是Farseer的新手,开发了xna + Farseer物理游戏。 There are multiple Physics bodies(square,circle, rectangle shapes) in the game, trying to findout all of the bodies in touch (touching each other), i can calculate based on the width/height but this will not be accurate. 游戏中有多个物理实体(方形,圆形,矩形形状),试图找到所有触摸的物体(相互接触),我可以根据宽度/高度计算,但这不准确。 i would like to know any other ways or any in built functions in Farseer physics 我想知道Farseer物理中任何其他方式或任何内置函数

Check out this answer for a lot of details. 看看这个答案有很多细节。 You may be able to use one of the events listed in that answer directly, depending on your needs. 您可以根据需要直接使用该答案中列出的某个事件。

But, otherwise, you can get Contact objects by either "collecting" them from one of those events, or by extracting them from Body.ContactList (which is a linked list made up of ContactEdge objects). 但是,否则,你可以Contact通过从这些事件中的一个或者“收集”起来,或通过提取它们的对象Body.ContactList (这是由链表ContactEdge对象)。

Note, of course, that a Contact might not actually be touching (it just indicates a potential collision). 当然,请注意, Contact可能实际上并未触摸 (它只是表示潜在的碰撞)。 Use Contact.IsTouching() to check for that. 使用Contact.IsTouching()来检查它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM