playMaker

Author Topic: Basic input.touches + Playmaker tutorial?[SOLVED]  (Read 4744 times)

4ppleseed

  • Full Member
  • ***
  • Posts: 226
Basic input.touches + Playmaker tutorial?[SOLVED]
« on: August 04, 2013, 04:47:48 PM »
Hi all,
Can I have a basic input.touches + Playmaker tutorial please?

I've read the set up page (add assets, add Gestures prefab, add proxy etc).

I'd just like to know how to set up an object that responds to a tap. I know that sounds simple but I'm a bit lost - do I have to use position? Why can't I just use a GameObject variable?

Tap cube, event happens... that's all I'm after for now, thanks :)
« Last Edit: October 30, 2013, 01:16:43 AM by jeanfabre »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Basic input.touches + Playmaker tutorial?
« Reply #1 on: August 05, 2013, 07:43:06 AM »
Hi,

 ok, InputTouche is only about touch events, it doesn't do more as is, if you want to have some detection, you have to implement it yourself.

 so, I created a small example to show you how to do it ( one way).

-- the cube watch for the input short tap event
-- it gets the position of the tap
-- then it performs a screen ray cast to find if an object was hit
-- it compare the result with itself, if it matches, then it means the tap was onthat game object.

the other way is to have this as a manager and send the "GAME OBJECT PICKED" to the hitted gameobject instead of having ALL the gameobjects doing the job. but that really depends on what you are after.

bye,

 Jean

4ppleseed

  • Full Member
  • ***
  • Posts: 226
Re: Basic input.touches + Playmaker tutorial?
« Reply #2 on: August 07, 2013, 04:01:43 PM »
Jean, this is great as always. You're a real asset to the Playmaker team  8)

dubnug

  • Playmaker Newbie
  • *
  • Posts: 22
Re: Basic input.touches + Playmaker tutorial?
« Reply #3 on: October 28, 2013, 10:22:22 PM »

Quote from: jeanfabre
the other way is to have this as a manager and send the "GAME OBJECT PICKED" to the hitted gameobject instead of having ALL the gameobjects doing the job. but that really depends on what you are after.

Hey Jean,

is there a chance that you could put up a demo of this sort of management system? I have a big collection of game objects, and I'd like a certain 'Info card' sprite to pop up specific to that game object upon a long tap. I really appreciate you posting the small example demo here but since I have so many objects, maybe it'd be best to have it laid out differently.

I'd appreciate it very much!  ;D Your posts have always been of great help to me.

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Basic input.touches + Playmaker tutorial?
« Reply #4 on: October 29, 2013, 03:04:54 AM »
Hi,

 ok, it's not very different actually, you simply do not compare and you fire an event to the hit object if indeed the touch position hitted a gameobject,

 Please find attached the scene, I implemented both short and long tap, WARNING, make sure you enable the long tap in the PlayMakerInputTouchProxy, otherwise long tap do not get register to begin with.

 The manager fires a global event "GAME OBJECT PICKED" or "GAME OBJECT LONG PICKED" to the GameObject target, so you only need to implement a fsm with either of these global event to be informed.

Bye,

 Jean

Yanifska

  • Full Member
  • ***
  • Posts: 163
    • My Portfolio
Re: Basic input.touches + Playmaker tutorial?
« Reply #5 on: October 29, 2013, 05:48:48 AM »
@4ppleseed,
Are you talking about the commercial action pack from the asset store ?
Visit my portfolio: http://www.yanivcahoua.com/

dubnug

  • Playmaker Newbie
  • *
  • Posts: 22
Re: Basic input.touches + Playmaker tutorial?
« Reply #6 on: October 30, 2013, 12:14:42 AM »
That wasn't too different at all, but it would've taken me hours to figure it out 100%. Thank you so much, Jean!

4ppleseed

  • Full Member
  • ***
  • Posts: 226
Re: Basic input.touches + Playmaker tutorial?
« Reply #7 on: November 04, 2013, 04:12:12 PM »
@4ppleseed,
Are you talking about the commercial action pack from the asset store ?

Yep.