This project has moved. For the latest updates, please go here.

Trying to understand the coordinate system

Topics: Developer Forum
Mar 17, 2011 at 5:48 AM

Hello all,

First post so I hope I don't irritate too many people with my question.  I did some searching around on how to convert screen coordinates to sim coordinates.  I am very familiar with Box2D and I'm not sure of all the differences between Box2D and Farseer.  I'm currently using Farseer to create an app for my WP7.  For now, the big difference I see between Box2D and Farseer is that Farseer uses the center of the screen as the origin whereas Box2D uses the top left corner of the screen...if I'm not mistaken.  From messing around, I'm also guessing that the coordinate system for Farseer is similar to the cartesian coordinate system where positive and negative values are relative to the origin?

My problem is...say I want to place my body at screen coordinate (139.55f, 665.05f).  When I converted using the ConvertUnits.ToSimUnits, I got the following Vector2 values for x and y: (1.3955, 6.6505).

When my game drew my body, it was far from being in the right place.  So I decided to hard code the value until I was roughly in the right positions and it was: (-6.25f, -16.55f).  I'm stumped!  I've searched and tried looking through the documentation but I couldn't find anything that would explain it to me.

Thanks in advance for your patience and your willingness to help me out!

Mar 17, 2011 at 6:35 AM

Nevermind...I solved it.  I didn't realize the project I was building from already had a screen to world conversion function.  Thanks!