Larger clickable area on an object
by Dave Young · in iTorque 2D · 01/19/2009 (2:24 pm) · 6 replies
I need to widen the clickable/touchable area on a sprite.
Anyone have some creative thoughts on how to do this? Are hotspots/invisible buttons doable? I've tried mounting another sprite with it's Alpha set to 1% but it won't work programatically.
Anyone have some creative thoughts on how to do this? Are hotspots/invisible buttons doable? I've tried mounting another sprite with it's Alpha set to 1% but it won't work programatically.
#2
01/19/2009 (3:06 pm)
My problem was that I wasn't adding the new overlays to the scenegraph! so they were always invisible ;)
#3
02/03/2009 (12:46 am)
is there also a way of doing this by - for example - adjusting the "hotspot" radius of the mouse?
#4
02/03/2009 (1:22 pm)
Not easily I think, the GUI layers drilldown through the layers using a single xy coord to see what the topmost gui control that is clickable is. To expand it as you say would mean doing a radius kindof search and figuring out what the most appropriate control is. Ouch!!
#5
but In this case I think we are not tlaking of a gui as sprites and "mount" are both non-gui things.
in those cases you can just use a radius query with a larger radius to get the objects in touch range
02/03/2009 (1:35 pm)
or just make the gui elements larger ;)but In this case I think we are not tlaking of a gui as sprites and "mount" are both non-gui things.
in those cases you can just use a radius query with a larger radius to get the objects in touch range
#6
02/03/2009 (3:20 pm)
You can mount a GUI to an t2dSceneObject though.
Torque Owner Warthog
Crude Games, LLC
I take a new sprite that has a very tiny completely transparent png in it and mount it to the sprite with the graphic. Just remember that the graphic is NOT the button and should not be set to clickable, and program the new blank overlay the way you would have programmed the graphic button. We have to mount them because we often move the graphic around and the "hot spot" needs to be there with it.