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!

  • 3
    \$\begingroup\$ 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. \$\endgroup\$ – MichaelHouse Feb 6 '13 at 4:36
  • 3
    \$\begingroup\$ gamedev.stackexchange.com/q/45445/10381 - this question has some good answers for this matter. \$\endgroup\$ – Tsvetan Feb 6 '13 at 4:52
  • \$\begingroup\$ 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. \$\endgroup\$ – Kwauhn Feb 6 '13 at 17:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.