Game Development Community

Detect objects under mouse cursor in 3D

by Santosh Pillai · in Technical Issues · 07/30/2008 (1:18 am) · 6 replies

I would like to detect the objects under the mouse cursor. Do I have to use raycasts or is there any other way to do that? Also if I use raycasts should I do that in some kind of scheduled funtion so that it happens every frame? I want to do this in 3d world and not in the GUI.

#1
08/07/2008 (11:44 pm)
Guys any luck?
#2
08/07/2008 (11:48 pm)
There is an Object Selection resource, from which you can get some ideas.

www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=2173

:)
#3
08/08/2008 (1:57 am)
But mainly I wanted to know if i have to raycast continuously to know what is the object below my cursor? Anyways, object selection link may definitely be useful.
#4
08/08/2008 (8:14 pm)
You can use that resource and probably do something like fire the raycast in the onMouseMove handler, which is the most likely suspect, and have calls to change the cursor accordingly.
#5
08/09/2008 (12:31 am)
In addition to its amazing effects choreography, the AFX package has object selection incorporated into its pre-merged code. It's also got datablock caching and other goodies that make it an essential add-on to Torque. It is well worth the money, and will save you quite a bit of development time.
#6
08/09/2008 (1:35 am)
Awesome thanks.... with the help of the resource and as suspected by Ted, it worked out perfectly.... Thanks a ton.....