0

My version of XNA: 4.0
My version of VS: 2010 Express
My version of Farseer: 3.5

I am attempting to implement the Farseer physics libraries into my XNA project. I downloaded the source code, and built the FarseerPhysics Xbox360 library as well as the DebugView Xbox360 library. I then attempted to add them to my new game solution by right clicking 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 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;

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.

I am also receiving errors when attempting to use DebugViewFlags.*, with the same error message being displayed.

Am I missing a step in building / adding a reference / using both of these libraries?

Feek
  • 640
  • 6
  • 20
  • in what namespace is ConvertUnits? – elios264 Aug 22 '14 at 16:33
  • 1
    it seems that is under FarseerPhysics only, so you should have this too : using FarseerPhysics; – elios264 Aug 22 '14 at 16:37
  • @elios264 I am such an idiot, thank you so much! Literally spent 2 hours building and rebuilding the libraries and didn't even think of `using FarseerPhysics;` – Feek Aug 22 '14 at 16:40

1 Answers1

0

with 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. ConvertUnits is a helper class that lets us switch between display units (pixels) and simulation units (MKS) easily.

This file can be downloaded here: http://farseerphysics.codeplex.com/releases/view/64108

Original Post at: 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 :)

Sam
  • 759
  • 1
  • 4
  • 10
  • hey @Feek, the original post was copied from farseerphysics.codeplex.com and the stackexchange post you pointed to is copied from codeplex – Sam Aug 23 '14 at 13:13