簡體   English   中英

我的Farseer Physics的實現/構建有什么問題,因為我不能調用某些類?

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

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

我試圖在我的XNA項目中實現Farseer物理庫。 我下載了源代碼,並構建了FarseerPhysics Xbox360庫以及DebugView Xbox360庫。 然后,我嘗試通過右鍵單擊references > add reference > and the corresponding .dll files.將它們添加到我的新游戲解決方案中references > add reference > and the corresponding .dll files.

然后,我在類的頂部添加了using語句,以便可以潛在地利用這些庫。

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

這些導入沒有收到錯誤,因此我的項目似乎正在查找庫。 實例化World world;時,我也沒有收到錯誤World world;

但是,當我嘗試在這些庫中使用某些類時,這就是發生錯誤的地方。

例如,嘗試使用ConvertUnits ,我收到以下錯誤消息:“當前上下文中不存在ConvertUnits名稱。我的代碼行是floor.Position = ConvertUnits.ToSimUnits(240, 775);我已驗證ConvertUnits文件已包含在FarseerPhysics的版本中。

嘗試使用DebugViewFlags.* ,我也收到錯誤消息,並顯示相同的錯誤消息。

我是否缺少建立/添加引用/使用這兩個庫的步驟?

使用3.x,FPE(Farseer Physics Engine)
可以在Farseer物理引擎3.3.1樣本XNA \\ Samples XNA \\ Samples XNA \\ ScreenSystem下找到ConvertUnits類。 ConvertUnits是一個幫助器類,使我們可以輕松在顯示單位(像素)和模擬單位(MKS)之間切換。

可以在這里下載此文件: http : //farseerphysics.codeplex.com/releases/view/64108

原始帖子位於: http : //farseerphysics.codeplex.com/discussions/247635

因此,您基本上需要將ConverUnits.cs文件添加到您的項目中,並且應該能夠將米轉換為像素就好了:)

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM