playMaker

Author Topic: [Solved] Having an issue tracking 2 GUI touch events  (Read 2376 times)

Lostcity

  • Playmaker Newbie
  • *
  • Posts: 31
[Solved] Having an issue tracking 2 GUI touch events
« on: July 24, 2014, 09:59:31 PM »
I'm creating a 2.5D side scroller for mobile hardware. I have a D-Pad GUI texture set up which has 2 invisible textures behind it that work as the actual touch spots. When one of the sides of the D-Pad gets pressed, I use a Touch GUI Event action which sets the velocity of my rigidbody character and moves him. I also have a jump and attack button on the other side of the screen.

The issue is that I need to be able to press both the D-Pad and Jump button at he same time without interference (or else the game is impossible). I also need to be able to press Jump without pressing any of the D-Pad buttons. Both of my D Pad buttons are are set to store a Finger ID with an INT of 0. My Jump and Attack buttons are set to a finger ID with an INT of 1.

What happens is that (when playing on my Nexus 4) the game will let me run and jump at the same time. However, if I press the jump button by itself, it won't function. The Jump button will only function if I'm also pressing the D-Pad.

I have not previously used more than one Touch GUI Event, so I'm a little lost as to how I can fix this issue. How can make 2 touchable GUI textures that can work both independently and simultaneously? Did I set up my finger IDs wrong?
« Last Edit: July 26, 2014, 02:07:11 PM by Lostcity »

Lostcity

  • Playmaker Newbie
  • *
  • Posts: 31
Re: [Solved] Having an issue tracking 2 GUI touch events
« Reply #1 on: July 26, 2014, 02:15:46 PM »
I was able to solve this issue. For any beginners out there, just so you know, the GUI Touch Event action can be used for Multi touch as long as you use the finger ID option. However, one touch will always take priority over another. So in my case, my Dpad and jump button worked great together, but my Dpad had priority (lower finger ID value). So I couldn't use my jump button by itself. It relied on the Dpad being pressed in order to function.

To fix this issue, I downloaded Touch Script, a free open source plugin off of the asset store which has Playmaker actions built in. Touch Script works great for Multi touch and with a little adjustments, I was able to convert all of my buttons to work with their playmaker actions. 

Long story short: if you need good multi touch, download the Touch Script plugin from the asset store.

clandestine

  • Sr. Member
  • ****
  • Posts: 255
    • ЯKD.ZONE
Re: [Solved] Having an issue tracking 2 GUI touch events
« Reply #2 on: July 28, 2014, 05:59:08 AM »
Thanks man, i'm in an Android project with a impossible deadline. This info is very useful. Already downloaded Touch Script!

Thanks

clandestine

  • Sr. Member
  • ****
  • Posts: 255
    • ЯKD.ZONE
Re: [Solved] Having an issue tracking 2 GUI touch events
« Reply #3 on: August 02, 2014, 09:40:46 AM »
... BUT decided to go with the default PM touch actions... and boom... the exact same limitation! Backed up the whole thing and will try and implement Touch Script later tonight.