Game Development Community

Mousepick without boundingbox

by Colossai Studios · in RTS Starter Kit · 05/03/2005 (11:59 pm) · 4 replies

Does the engine support mousepick on objects without using the cubic bounding box? I need the player to be able to click on objects with very irregular shapes.

#1
05/04/2005 (2:55 pm)
Yes it does, if you notice when you move your cursor over just one unit it will highlight and you can select it without drawing a box. The code for it is in rts/guiRTSTSCtrl.cc in the funciton void GuiRTSTSCtrl::on3DMouseMove. It does some "collision" checking to see if the cursor is over a unit, you should be able to extend this to other classes if need be.
#2
05/05/2005 (11:35 pm)
From my understanding so long as you derive the object from an rtsunit the current picking will work. i think it just fires a ray from the camera through the world coordinates the cursor is at and check if any rtsunits exist at that point.
#3
05/06/2005 (7:34 am)
Hmm, when a model is created in Maya (or another program) a cubic bounding box have to be created that includes the whole model. I suspect this (invisible) box is what the ray actually collides with. I'll have to do some testing on this.
#4
05/06/2005 (3:32 pm)
Im agree with you Joakim, and if that is true then I cant help you because im also looking for a way to change the bounding box to a sphere or other shape with no luck, but then again im a begginer at this.