Game Development Stack Exchange is a question and answer site for professional and independent game developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to convert the camera coordinate to screen coordinate. I have asked this question because my camera is 48m wide and 32m high but my screen is 480x320 pixels. So whatever collision point I get those are based on camera. Also I like to mention that my camera set at center of the screen. So I get (0,0) coordinate at middle of the screen. At collision time I put some particle effect but now that particle effect not at correct place in the screen. So someone from community please help.

share|improve this question

How about using the project-method in the camera class.

camera.project(Vector3 worldPoint)

That projects the vector cameraPoint from world/camera coordinates into screen/window coordinates. The reverse method is camera.unproject(Vector3 screenPoint). Have a look at the libgdx camera class.

share|improve this answer
This is the right way to do it +1 :D – arielsan Aug 24 '12 at 16:21

Taken from

I'm only assuming that this will help based on your question...

Ray pickRay = cam.getPickRay(Gdx.input.getX(), Gdx.input.getY());
Intersector.intersectRayPlane(pickRay, xzPlane, intersection);
share|improve this answer
Thanks, this is exactly what I needed. – jellyfication Jun 5 '13 at 10:58

What you need to do is to translate the camera coordinates into viewspace.

In this particular case your Camera coordinates go from [-24,-16] to [24,16] and you want that to translate to [0,0] to [480,320].

Pseudo code:

view.X = camera.X * 10 + view.width / 2
view.Y = camera.Y * 10 + view.height / 2
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.