Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

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'm new here and I'm not sure how to go about doing this. I am creating an application that is supposed to use the cursor's position in the window to perform 3d picking. The tutorials I have found only explain casting a ray out of the center of the camera (like from a cross-hair), but this isn't helpful because the mouse isn't always in the center. I'm looking to understand how I could go about extruding the picking ray based on the mouse's x and y position over the window.

Also, it's not as much about the picking as it is casting the ray in the right direction. Picking will be handled by getting points in the ray and checking to see if the unit at that point is full or not.

Any help is greatly appreciated, please be respectful, and thanks in advance!

share|improve this question
Ray casting and picking questions have been asked before. Search the site, if you don't find the answers you need then ask your question. – Byte56 Feb 6 '13 at 4:36
3 - this question has some good answers for this matter. – Tsvetan Feb 6 '13 at 4:52
Thanks guys, the answers to other questions aren't exactly what I'm looking for, but I guess I'll just have to learn from them and work it out myself. – Kwauhn Feb 6 '13 at 17:09

Your Answer


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

Browse other questions tagged or ask your own question.