playMaker

Author Topic: Touch Cancel/Ended  (Read 6308 times)

KellyRay

  • Full Member
  • ***
  • Posts: 170
Touch Cancel/Ended
« on: November 04, 2013, 09:34:01 PM »
Has anyone experienced troubles with the Touch Event action. Specifically, trouble with ending a touch? I've got a real simple set up. I am translating a cube on touch. I have it set up with a touch begin sends the event to another state where I move the cube and look for a touch end which sends it back.

Works sometimes but after a few times the I lift up on the touch and the cube continues to move.

Any thoughts?

I'm currently using the Unity Remote app on my iphone if that gives anyone some insight into my problem.




Vink

  • Playmaker Newbie
  • *
  • Posts: 19
Re: Touch Cancel/Ended
« Reply #1 on: November 04, 2013, 10:53:38 PM »
Hi

Try storing the finger in an Int variable in the first state and then in the second state let it check for when you lift that finger up.


KellyRay

  • Full Member
  • ***
  • Posts: 170
Re: Touch Cancel/Ended
« Reply #2 on: November 04, 2013, 11:05:42 PM »
I believe I have done this through the store finger id variables. Is this what you are talking about? Or is there another way?

Vink

  • Playmaker Newbie
  • *
  • Posts: 19
Re: Touch Cancel/Ended
« Reply #3 on: November 04, 2013, 11:23:43 PM »
Hi

What actions are you using in the second state?

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Touch Cancel/Ended
« Reply #4 on: November 05, 2013, 02:02:34 AM »
Hi,

 Also, make sure you also listen to the "cancel" state of a touch, else dragging outside the screen will never trigger ( as it is different then ending the touch properly).

bye,

 Jean

Vink

  • Playmaker Newbie
  • *
  • Posts: 19
Re: Touch Cancel/Ended
« Reply #5 on: November 05, 2013, 08:15:47 AM »
Hi

I just had a similar problem where it didnt want to go to the next state.
Mine is a "Touch Object event" in the first and second state, so i had to release my finger over the object as well to go to the next state, so i swapped the "touch object event" on the second state with a normal "Touch Event" and that fixed it.

hope this info is usefull

KellyRay

  • Full Member
  • ***
  • Posts: 170
Re: Touch Cancel/Ended
« Reply #6 on: November 07, 2013, 07:51:29 PM »
Jean, does this mean that I have to listen for cancel in each state that is looking for a touch?

Hi,

 Also, make sure you also listen to the "cancel" state of a touch, else dragging outside the screen will never trigger ( as it is different then ending the touch properly).

bye,

 Jean

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Touch Cancel/Ended
« Reply #7 on: November 08, 2013, 12:41:28 AM »
Hi,

 Yes, for each state that wants to know when the touch ends.

bye,

 Jean

KellyRay

  • Full Member
  • ***
  • Posts: 170
Re: Touch Cancel/Ended
« Reply #8 on: November 14, 2013, 01:15:56 PM »
I've added the end/cancel watcher to every state that I want to watch for the touch however I'm running into the same problem I had before.

I'm thinking that it might be a problem with Unity remote. I begin a touch and it sends my event just fine, however when I lift up, the touch doesn't appear to be registering that its ended.

I've even tried it in the MoveMobileTouch example you posted awhile back Jean and had the same thing happen. Anyone else experience this with the Unity Remote?

Unfortunately I am not an apple developer and can't just export a test. I plan on becoming one but for the time being I am hoping to use the Unity remote app to build prototypes.

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Touch Cancel/Ended
« Reply #9 on: November 15, 2013, 06:04:32 AM »
Hi,
 
 I see. Indeed Unity Remote can not be relied upon for very accurate touch events, sometimes it misses events if you are going to fast with your fingers. Try again but slowly, waiting before each move and release.

 You can't rely on Unity Remote, you must test on the actual device to guarantee that a behavior is working or not. Unity Remote will help you progress during your day without constantly having to publish, but still, you are expected to export on the device for a final check.

bye,

 jean