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 would like to convert touch/click input (2D coordinates) to 3D coordinates by dropping the Z axis (would like to move only up/down, left/right (Z is the axis for depth).

The problem is that the coordinates i get from input (2d) aren't corelated with the 3d actual space.

Does XNA provide a way to do this?

share|improve this question
Just a guess, mouse ray can be the answer (: – Gustavo Maciel Jan 19 '12 at 11:10
@Gtoknu thanks! i'll give it a try! i'll be back with feedback – Alex Jan 19 '12 at 11:22

You want to have a look at this:

share|improve this answer
this only shows if a touch input intersects an object. i actually need to generate the next position (while dragging) for the object. i solved it with some good ol' fashion vector geometry :… – Alex Jan 21 '12 at 8:32
Using unproject from the near plane and far plane you get a line segment that spans the entire camera's view, you could then move your object along that line segment. However, as you've said, you've already solved the problem. – Nic Foster Jan 23 '12 at 19:10

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.