playMaker

Author Topic: Why doesn't Touch Object 2D Event have 'Not Touching' like Touch GUI event??  (Read 7301 times)

4ppleseed

  • Full Member
  • ***
  • Posts: 227
    • View Profile
not 100% sure how to set up in playmaker/unity, but I solved the same problem in another engine by spawning a small object at the touch position, and then monitoring the collision between the touch object and the button. Releasing touch destroys the object.

Should be simple enough to implement in playmaker, would that work here?

Thanks, I'm pretty desperate to make it work, so I'll give this a go! It sounds just as equally complex as my current solution - so it can't be any worse  ;D

PlaymakerNOOB

  • Full Member
  • ***
  • Posts: 165
    • View Profile
I had the same problem, but resolved it by looking at it a different way.

Touch Object 2D Event (Start)
Touch Began, Touch Moved, Touch Stationary all trigger "Touch Start"
Store the fingerID as an int

Then send an event to specified FSM. In my case it was a gameobject that managed all the inputs.  Then a finished event

Touch Object 2D Event (Stop)
Filtered by fingerID as int
Touch Ended, Touch Canceled all trigger "Touch Stopped"

Then send an event to specified FSM. In my case it was a gameobject that managed all the inputs.  Then a finished event

Back to start.
« Last Edit: March 10, 2015, 05:09:43 PM by PlaymakerNOOB »

4ppleseed

  • Full Member
  • ***
  • Posts: 227
    • View Profile
I had the same problem, but resolved it by looking at it a different way.

Touch Object 2D Event (Start)
Touch Began, Touch Moved, Touch Stationary all trigger "Touch Start"
Store the fingerID as an int

Then send an event to specified FSM. In my case it was a gameobject that managed all the inputs.  Then a finished event

Touch Object 2D Event (Stop)
Filtered by fingerID as int
Touch Ended, Touch Canceled all trigger "Touch Stopped"

Then send an event to specified FSM. In my case it was a gameobject that managed all the inputs.  Then a finished event

Back to start.

I tried this and the problem remains. If I press down the button and slide my finger off the button, it remains down.

PlaymakerNOOB

  • Full Member
  • ***
  • Posts: 165
    • View Profile
Yep, went back and looked... I am also using the Touch GUI Event.  As 4ppleseed mentions, quite odd that not touching is only available in the Touch GUI event.

Though, maybe its me, i cant seem to get Touch GUI events to work correctly in Unity 5.

Edit -- I did get Touch GUI to work, I just forgot I need to "Make it visible" by having its screen position set somewhere between 0-1.

I think AllorNothing's suggestion is probably the best, as you can easily scale the object under the players finger.  Though it would require creating an object for each touch.  That way you can drag a finger onto the button and have it trigger and stop when its slid off.

not 100% sure how to set up in playmaker/unity, but I solved the same problem in another engine by spawning a small object at the touch position, and then monitoring the collision between the touch object and the button. Releasing touch destroys the object.

Should be simple enough to implement in playmaker, would that work here?

« Last Edit: March 13, 2015, 09:13:49 PM by PlaymakerNOOB »

4ppleseed

  • Full Member
  • ***
  • Posts: 227
    • View Profile
Yep. I'm thinking the spawning an object that tracks play finger when down is the only way to go. Hey ho, off to rewrite my whole project I go  ::)

4ppleseed

  • Full Member
  • ***
  • Posts: 227
    • View Profile

I don't think there is a simple way even in scripts. If you find script that does what you need, let me know, I'll see how it's been made and work out a solution in PlayMaker if it turns out simple.


Hi Jean,
Today out of desperation, I re-installed Unity 4.5.5

I used the Touch GUI Event...



And it works perfectly in my game.

It seems the Touch GUI Event is more advanced than the Touch Object 2D Event when it comes to options. But of course it's now obsolete since 4.6+

Is there a way you can add the functions of Touch GUI to Touch 2d Object? Especially 'Not Touching'.

Otherwise I'll have to convert the whole of my game from Rigidbody/Collision 2d to 3d and continue in 4.5 :(

Thanks.

PlaymakerNOOB

  • Full Member
  • ***
  • Posts: 165
    • View Profile
Its not obsolete, Gui Texture still functions in Unity 5.

4ppleseed

  • Full Member
  • ***
  • Posts: 227
    • View Profile
Its not obsolete, Gui Texture still functions in Unity 5.

http://docs.unity3d.com/Manual/class-GuiTexture.html it says they are legacy in the Unity manual. How do you create a GUI Texture in Unity 5? Which menu is it in?

Edit: Hmmm.. I'm reading if you add an empty game object you can still add it as a component? Is that true?  :D
« Last Edit: March 14, 2015, 05:18:24 PM by 4ppleseed »

PlaymakerNOOB

  • Full Member
  • ***
  • Posts: 165
    • View Profile
Its considered legacy and outdated, although still supported.

In Unity 4.6 & Unity 5, Yes, you can add it as a Component.

Though, it has higher draw calls vs the new UnityGUI.  Although really, its probably negligible unless you get crazy with the GuiTextures.

4ppleseed

  • Full Member
  • ***
  • Posts: 227
    • View Profile
Ta. This works in U5 and it'll have to do for now  8)