简体   繁体   English

我的Farseer Physics的实现/构建有什么问题,因为我不能调用某些类?

[英]What is wrong with my implementation / build of Farseer Physics in that I can't call certain classes?

My version of XNA: 4.0 我的XNA版本:4.0
My version of VS: 2010 Express 我的VS版本:2010 Express
My version of Farseer: 3.5 我的Farseer版本:3.5

I am attempting to implement the Farseer physics libraries into my XNA project. 我试图在我的XNA项目中实现Farseer物理库。 I downloaded the source code, and built the FarseerPhysics Xbox360 library as well as the DebugView Xbox360 library. 我下载了源代码,并构建了FarseerPhysics Xbox360库以及DebugView Xbox360库。 I then attempted to add them to my new game solution by right clicking references > add reference > and the corresponding .dll files. 然后,我尝试通过右键单击references > add reference > and the corresponding .dll files.将它们添加到我的新游戏解决方案中references > add reference > and the corresponding .dll files.

I then added the using statements at the top of my class so that I could potentially utilize the libraries. 然后,我在类的顶部添加了using语句,以便可以潜在地利用这些库。

using FarseerPhysics.Dynamics; using FarseerPhysics.Factories; using FarseerPhysics.DebugView;

I am not receiving errors with these imports, so my project seems to be finding the libraries. 这些导入没有收到错误,因此我的项目似乎正在查找库。 I also do not receive an error when instantiating the likes of World world; 实例化World world;时,我也没有收到错误World world;

However, when I attempt to use certain classes within these libraries, that's where my errors occur. 但是,当我尝试在这些库中使用某些类时,这就是发生错误的地方。

For example, attempting to use ConvertUnits , I receive the following error "The name ConvertUnits does not exist in the current context. My line of code is floor.Position = ConvertUnits.ToSimUnits(240, 775); I have verified that the ConvertUnits file has been included in the build of FarseerPhysics. 例如,尝试使用ConvertUnits ,我收到以下错误消息:“当前上下文中不存在ConvertUnits名称。我的代码行是floor.Position = ConvertUnits.ToSimUnits(240, 775);我已验证ConvertUnits文件已包含在FarseerPhysics的版本中。

I am also receiving errors when attempting to use DebugViewFlags.* , with the same error message being displayed. 尝试使用DebugViewFlags.* ,我也收到错误消息,并显示相同的错误消息。

Am I missing a step in building / adding a reference / using both of these libraries? 我是否缺少建立/添加引用/使用这两个库的步骤?

with 3.x, FPE(Farseer Physics Engine) 使用3.x,FPE(Farseer Physics Engine)
The ConvertUnits class can be found under Farseer Physics Engine 3.3.1 Samples XNA\\Samples XNA\\Samples XNA\\ScreenSystem. 可以在Farseer物理引擎3.3.1样本XNA \\ Samples XNA \\ Samples XNA \\ ScreenSystem下找到ConvertUnits类。 ConvertUnits is a helper class that lets us switch between display units (pixels) and simulation units (MKS) easily. ConvertUnits是一个帮助器类,使我们可以轻松在显示单位(像素)和模拟单位(MKS)之间切换。

This file can be downloaded here: http://farseerphysics.codeplex.com/releases/view/64108 可以在这里下载此文件: http : //farseerphysics.codeplex.com/releases/view/64108

Original Post at: http://farseerphysics.codeplex.com/discussions/247635 原始帖子位于: http : //farseerphysics.codeplex.com/discussions/247635

So you basically need to add the ConverUnits.cs file to your project, and you should be able to convert meters to pixels just fine :) 因此,您基本上需要将ConverUnits.cs文件添加到您的项目中,并且应该能够将米转换为像素就好了:)

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

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