Make two object receive the tap gesture?

Ask for help and post bugs.

Make two object receive the tap gesture?

Postby Raphael Nunes » Thu Oct 19, 2017 12:03 am

Sorry if someone already posted about this subject, but i was unable to find it.

Can two objetos (overlapping each other) can recevei the the tap gesture? I know that exists the "Friendly Gestures", but in my case is two diferentes objetos.
Example: I'm trying to do a game that the player has to kill some bugs tapping on them, but regardless of where the player touch a particle is instantiated, so if the player touch a bug i need that the bug receive the tap and the particle is instantiated on that position and if the player touch in elsewhere i only need to instantiate the particle.
My first try was add an 'PointersPressed' at the TouchManager and instantiate the particle on the firts pointer position, but didn't work because when the player hit an UI like a button i need to know to not instantate the particle. My second try was use two cameras with two point layers, but that doesn't work too.
Raphael Nunes
 
Posts: 2
Joined: Wed Oct 18, 2017 11:33 pm

Re: Make two object receive the tap gesture?

Postby valyard » Tue Oct 24, 2017 11:39 am

Sorry I don't understand why you just don't add a TapGesture on each bug. This way taps will only be recognized by bug objects.
valyard
Site Admin
 
Posts: 422
Joined: Mon Sep 08, 2014 11:57 pm

Re: Make two object receive the tap gesture?

Postby Raphael Nunes » Sun Nov 05, 2017 7:48 pm

Sorry, i'm having dificult to express my problem. I wil try again:
I need two objects to receive the gesture even though one is on top of the other, that is, even though the two are in the same position. Currently if one object is above the other, only the object from above will receive the gesture, but I need all the objects that are below also to receive the gesture, so if you have ten objects one over the other (in the same position) all receive the gesture.
Raphael Nunes
 
Posts: 2
Joined: Wed Oct 18, 2017 11:33 pm

Re: Make two object receive the tap gesture?

Postby valyard » Sun Nov 05, 2017 8:54 pm

I see. I guess, this is one of those situations when TouchScript's architecture is a serious limitation. A pointer can have only one target, so tapping many targets at once is impossible.

What you can do is to catch tap with a parent object for these bugs, like have a big collider on a container game object which will get taps. When you got a tap you can raycast it further into all other bugs to see which ones should be destroyed. But this approach with taps has a limitation that you can have only one simultaneous tap going on on that container object.

You can also write a custom gesture which will raycast every pointer or have a MetaGesture and subscribe to its events to do the same.

Unfortunately, I don't see an elegant solution right now.
valyard
Site Admin
 
Posts: 422
Joined: Mon Sep 08, 2014 11:57 pm


Return to Help and Bugs

Who is online

Users browsing this forum: No registered users and 1 guest