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

FPE 3.0 units conversion

Topics: Developer Forum, User Forum
Sep 22, 2010 at 8:40 PM


Quick question: I am using screen management just same like in TestBed, and there I have:

public Vector2 ConvertScreenToWorld(int x, int y)
      float u = x / (float)_viewportWidth;
      float v = (_viewportHeight - y) / (float)_viewportHeight;

      Vector2 p = new Vector2();
      p.X = (1.0f - u) * _lower.X + u * _upper.X;
      p.Y = (1.0f - v) * _lower.Y + v * _upper.Y;

 return p;
Could somebody guide me how to get WorldToScreen conversion? It would be great, because I cannot put any texture on the body without it. Thanks in advance!