Game Development Community

Detect if mouse/touch click/press on actor

by Andrea Farid Marsili · in Torque Game Builder · 02/20/2011 (12:25 am) · 1 replies

As you read in the title:
How can I detect if mouse/touch click/press on a single actor?

#1
02/20/2011 (7:19 am)
When you create your actor, add it to an array.

For your scnegraph create a series of mouse callback functions. ex:

sceneWindow2D::onMouseMove( %this, %mod, %worldPos, %mouseClicks )
function sceneWindow2D::onMouseDragged( %this, %mod, %worldPos, %mouseClicks )

etc. then in the one you want to do the checking loop through the array and check if it is over anything in the array.

You should really try reading through the TDN tutorials and the documentation that came with TGB. Pretty much all of this is covered in tutorials as well as your other posts.