playMaker

Author Topic: Input.Touches Multi Drag FSM  (Read 3494 times)

izzycoding

  • Playmaker Newbie
  • *
  • Posts: 29
Input.Touches Multi Drag FSM
« on: May 27, 2013, 02:46:01 PM »
Hey,

I am trying to figure out how to use Input.Touches and the PlayMaker Actions to allow me to have multiple finger to drag multiple objects fixed on the y axis.
Rough idea of what I am trying to achieve is a control mechanism for a game similar to PONG.

Any ideas as I am struggling and not sure where to start. I have the Gesture Prefab in place with only the Drag Detector Enabled, and also the Proxy Prefab with the Drag and Multi Drag options on.
Now how do I know when a drag event occurs? How do I determine which paddle the drag event is for?

Any information on this would be a great help.

Regards,

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Input.Touches Multi Drag FSM
« Reply #1 on: May 28, 2013, 01:46:07 AM »
Hi,

 Input.Touches only inform you about touches, it doesn't check what object you are touching or dragging, you'll have to implement this yourself.

 the key is the following:

 when you receive a Drag start, you get the position of the drag and perform a raycast, if you hit a paddle, then you link that paddle with this drag touch Id,

Does that make sense?

bye,

 Jean

izzycoding

  • Playmaker Newbie
  • *
  • Posts: 29
Re: Input.Touches Multi Drag FSM
« Reply #2 on: May 28, 2013, 02:40:24 AM »
Hi,

Thanks, that is great.
Is there an action to detect the start and end? I can only see a singe DragInfo one so not sure how to do it just with an fsm.

Regards,

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Input.Touches Multi Drag FSM
« Reply #3 on: May 28, 2013, 07:06:41 AM »
Hi,

 Better than that, you get global events for this:

INPUT TOUCHES / DRAGGING START
INPUT TOUCHES / DRAGGING END
INPUT TOUCHES / DRAGGING

check the PlayMakerInputTouchesProxy to see all the available events.

there is also the help on the wiki:

https://hutonggames.fogbugz.com/default.asp?W961

bye,

 Jean

izzycoding

  • Playmaker Newbie
  • *
  • Posts: 29
Re: Input.Touches Multi Drag FSM [Solved]
« Reply #4 on: May 28, 2013, 09:03:56 AM »
Hi,

Great Thanks.
I will set this up tonight and see what happens.

Regards,

izzycoding

  • Playmaker Newbie
  • *
  • Posts: 29
Re: Input.Touches Multi Drag FSM
« Reply #5 on: May 28, 2013, 03:01:49 PM »
Hey,

I have just put in the things mentioned. I have used the GetDragInfo Action.
1) how do I get the Vector2 into a usable for to set my objects position?
2) is there any way to improve the feed back as it looks very jerky what I have at the moment.

Regards,

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Input.Touches Multi Drag FSM
« Reply #6 on: May 29, 2013, 02:23:04 AM »
Hi,

 You can save a vector2 as vector3 with this action:
http://hutonggames.com/playmakerforum/index.php?topic=2894.msg13196#msg13196

are you testing on the device or with the unity remote?

bye,

 Jean

izzycoding

  • Playmaker Newbie
  • *
  • Posts: 29
Re: Input.Touches Multi Drag FSM
« Reply #7 on: May 29, 2013, 02:40:18 AM »
Hi,

Cool, I can use that for something else.
However, the values only ever go from 0 up. Is there a way to convert it into a proper screen coordinate (-30 > +30)?
I am currently testing in the unity editor at the moment.

Regards,

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Input.Touches Multi Drag FSM
« Reply #8 on: May 29, 2013, 05:44:49 AM »
Hi,

 What Value? the delta position of the position itself? These are already screen coordinates, only if you watch the delta position, it will be likely always around 0, since it's the discret movement since the last frame ( 1/30th of a second if you run at 30FPS), so it's laways close to nothing, it's only when you add it up as you translate the camera or something that the delta position becomes valuable.

bye,

 Jean

izzycoding

  • Playmaker Newbie
  • *
  • Posts: 29
Re: Input.Touches Multi Drag FSM
« Reply #9 on: May 29, 2013, 08:38:20 AM »
Hi,

My current FSM uses the delta position and adds it to the current position of my gameObject.

Think I have just thought of a possible solution. Will try and get back with results.

Regards,