首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Farseer ContactListener不工作

Farseer ContactListener不工作
EN

Stack Overflow用户
提问于 2013-05-20 02:19:16
回答 1查看 237关注 0票数 1

我在我的XNA项目中使用了Farseer,但我在使用ContactListener时遇到了一些问题。我为我的ContactListener创建了一个类,但我总是收到这两个错误消息,并且我不知道如何修复这些问题。

找不到类型或命名空间名称“ContactListener”(是否缺少using指令或程序集引用?)

找不到类型或命名空间名称“ContactImpulse”(是否缺少using指令或程序集引用?)

我的ContactListener类出了什么问题?

代码语言:javascript
复制
class MyContactListener: ContactListener
{
    void BeginContact(Contact contact)

    { /* handle begin event */ }


    void EndContact(Contact contact)

    { /* handle end event */ }


     void PreSolve(Contact contact, ref Manifold oldManifold)
    {
      Fixture fixtureA = contact.FixtureA;
      Fixture fixtureB = contact.FixtureB;

      if (fixtureB.CollisionCategories == Category.Cat10)
      {
        contact.Enabled = false;
      }
    }

    void PostSolve(Contact contact, ref ContactImpulse impulse)

   { /* handle post-solve event */ }

}
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2013-05-20 03:23:07

试试这个:

  • 打开VS
  • 转到Solution Explorer窗口
  • 搜索名为References的文件夹,然后右键单击该文件夹
  • 选择Add Reference...
  • look

Farseer组件并添加它

代码语言:javascript
复制
using FarseerPhysics.Collision.Shapes;
using FarseerPhysics.Common;
using FarseerPhysics.Dynamics;
using FarseerPhysics.Dynamics.Contacts;
using FarseerPhysics.Factories;
using FarseerPhysics.TestBed.Framework;
using Microsoft.Xna.Framework;
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/16637947

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档