This project has moved and is read-only. For the latest updates, please go here.

Vector2 namespace collision?

Topics: User Forum
Jul 30, 2008 at 5:33 AM
Edited Jul 30, 2008 at 5:35 AM

I'm getting the following errors when attempting to compile:
The best overloaded method match for 'FarseerGames.FarseerPhysics.PhysicsSimulator.PhysicsSimulator(FarseerGames.FarseerPhysics.Mathematics.Vector2)' has some invalid arguments


Argument '1': cannot convert from 'Microsoft.Xna.Framework.Vector2' to 'FarseerGames.FarseerPhysics.Mathematics.Vector2'

the line of code they refer to is:
physicsSimulator = new PhysicsSimulator(new Vector2(0, 200));

Anyone have any suggestions?

Jul 30, 2008 at 9:10 AM
I don't know if there's any better solution but it works for me anyway, so:

Instead of,

physicsSimulator = new PhysicsSimulator(new Vector2(0, 200));

I use,

physicsSimulator = new PhysicsSimulator(new FarseerGames.FarseerPhysics.Mathematics.Vector2(0, 200));

The problem lies in the Vector2 class which both FarseerPhysics and XNA has.
Jul 31, 2008 at 2:20 PM
Vector2 was implemented in Farseer so that the simulator could run without having XNA installed. It should be wrapped in a conditional pre-processor directive that excludes it from the project if the XNA framework is present. Did you change any of that code?
Aug 1, 2008 at 7:08 PM
@DeusVult - Yeah, I tried that to right after posting. This is fine until you try to draw using those vectors as screen cords (like in the quick start project)

@wmfwlr - Ahhh, good to know. I'll comment out that pragma and try again.

Aug 3, 2008 at 7:39 PM
Take a look at this thread: