playMaker

Author Topic: Touch GUI Event [SOLVED]  (Read 4979 times)

coxy17

  • Beta Group
  • Sr. Member
  • *
  • Posts: 355
Touch GUI Event [SOLVED]
« on: January 26, 2014, 02:48:55 PM »
Hi,

I have setup a jump action and have got it to work with keyboard keys.

Im trying to include the 'touch gui event' alongside the keyboard keys to achieve touchscreen support.

Basically the character runs (holding down forward GUI button) and then they can press jump (jump GUI button - still holding the forward button). This is the action which is not working correctly when using the GUI Event buttons. It works fine with the keyboard alternative key (space bar).

The problem is when i go to jump (currently holding the forward GUI) it sometimes works and sometimes nothing happens.

Does having two GUI events on 2 seperate FSM scripts on one object cause issues?

hope this makes sense (included screenshot of jump action with the jump GUI)

Nick

 
« Last Edit: February 08, 2014, 03:11:46 PM by coxy17 »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Touch GUI Event
« Reply #1 on: January 29, 2014, 02:39:17 AM »
Hi,

 you always must record the finger id to avoid confusion when listenning to further touch events ( cancel, release), so always record the finger id and then use it to keep watch that specific finger behavior.

bye,

 Jean

coxy17

  • Beta Group
  • Sr. Member
  • *
  • Posts: 355
Re: Touch GUI Event
« Reply #2 on: January 30, 2014, 06:36:00 PM »
ok, im a little confused still as ive created a int variable and have tried the same setup as before (screenshot) including the 'finger_id'.

Ive also tried separating the 'touch began' and 'touch_ended' to 2 separate states and have tested but with no luck still.

sorry if im not being clear. (attached screenshot)

Nick

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Touch GUI Event
« Reply #3 on: January 31, 2014, 07:42:14 AM »
Hi,

don't filter by the finger Id when you want to catch the beginning of a touch, only store the id when beginning, it's then that you filter by that ID you got when the touch began, and the subsequent process must only deal with this finger id.

bye,

 Jean

coxy17

  • Beta Group
  • Sr. Member
  • *
  • Posts: 355
Re: Touch GUI Event
« Reply #4 on: January 31, 2014, 07:03:39 PM »
Hi,

ok. So does that mean that i would roughly set it out like below?

1. Touch GUI event (store finger id)
2. go to my action state
3. then go to a wait state with the finger id defined in touch event
4. go to second action state
5. create another state to stop it going back to the beginning so i can use a touch event then to send it back to step 2.

Nick

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Touch GUI Event
« Reply #5 on: February 03, 2014, 05:01:34 AM »
Hi,

 yep.

bye,

 Jean

coxy17

  • Beta Group
  • Sr. Member
  • *
  • Posts: 355
Re: Touch GUI Event
« Reply #6 on: February 05, 2014, 06:07:29 PM »
Hi,

The logic works. However, the touches work when finger touches buttons (exactly) but for some reason i can touch anywhere else on the screen to control the same actions? its like the touch is not tied to the button space (surface area)?

I have both FSM's on the Camera and have the same setup as in screenshot/previous post, except they both have separate finger id's and rotation angles.

Hope it makes sense
« Last Edit: February 05, 2014, 06:13:18 PM by coxy17 »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Touch GUI Event
« Reply #7 on: February 07, 2014, 07:33:23 AM »
Hi,

 touch event are NOT linked to the object you are using it, it's just a touch event on the screen.

 you have to use "touch Object event" for this.

bye,

 Jean

coxy17

  • Beta Group
  • Sr. Member
  • *
  • Posts: 355
Re: Touch GUI Event
« Reply #8 on: February 07, 2014, 11:32:13 AM »
Thanks for your time Jean,

I'll give that a go.

coxy17

  • Beta Group
  • Sr. Member
  • *
  • Posts: 355
Re: Touch GUI Event [SOLVED]
« Reply #9 on: February 08, 2014, 03:08:28 PM »
That worked!!!! Thanks Jean.  :)