我在我的XNA项目中使用了Farseer,但我在使用ContactListener时遇到了一些问题。我为我的ContactListener创建了一个类,但我总是收到这两个错误消息,并且我不知道如何修复这些问题。
找不到类型或命名空间名称“ContactListener”(是否缺少using指令或程序集引用?)
找不到类型或命名空间名称“ContactImpulse”(是否缺少using指令或程序集引用?)
我的ContactListener类出了什么问题?
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 */ }
}发布于 2013-05-20 03:23:07
试试这个:
Solution Explorer窗口References的文件夹,然后右键单击该文件夹Add Reference...Farseer组件并添加它
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;https://stackoverflow.com/questions/16637947
复制相似问题