playMaker

Author Topic: Swiping Objects  (Read 4768 times)

Justin

  • Junior Playmaker
  • **
  • Posts: 58
Swiping Objects
« on: August 15, 2013, 05:52:13 PM »
Hi, I wanted to know if it was possible to make the following with the device actions in playmaker, and if not what package would be the best to buy input.touches, fingergestures, or possibly easytouch3?  I’m leaning toward input.touches because it has playmaker support but it honestly doesn’t look as good as the other two.

Basically all I am trying to do is setup a scene where the player can swipe falling 3d objects to the left and right of the screen.  Sounds simple but I haven’t been able to get it to behave correctly.

Right now I have it setup like so - The FSM is on the object.

Listens for swipe left or right – if swiped sends corresponding event
TouchObjectEvent; if touched sends event
Follows finger; once let go send event
Apply velocity to object to look like it has been thrown; (I’m not sure how to do this)

I don’t think this is even the best way of doing this, as it doesn’t always grab the object when you swipe over it.  If anyone has any advice or suggestions I’de be very grateful, thank you.  :)

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Swiping Objects
« Reply #1 on: August 16, 2013, 04:57:44 AM »
Hi,

 What you want, based on my understanding of your explanation os to catch falling objects. for this I have a sample ready :)

http://hutonggames.com/playmakerforum/index.php?topic=1286.msg17057#msg17057

bye,

Jean

Justin

  • Junior Playmaker
  • **
  • Posts: 58
Re: Swiping Objects
« Reply #2 on: August 16, 2013, 04:00:13 PM »
Thanks for the reply, although I don't think that is exactly what I'm looking for, it may help with the last part I'm still working on that.  I probably didn't word my problem very well. Simply, I want to be able to swipe falling objects.

I'm basically trying to understand how to make a "Swipe Object Event" that would behave similar to the "Touch Object Event," if that is even possible. But instead of being able to touch the object it would only trigger the event if a swipe passed over it.

Red

  • Hero Member
  • *****
  • Posts: 563
Re: Swiping Objects
« Reply #3 on: August 16, 2013, 07:23:30 PM »
Hmm, Well, I don't have much experience with mobile use but from what I understand a "Swipe" is, essentially, a click+drag. (as in, you register where the point starts by a click/touch... you then track the path you're taking... and when the release is registered, the next set of actions are called.)

Now, This approach I'm about to do is more for a mouse but I would imagine that it wouldn't be too difficult to get that kind of fruit-ninja control scheme going.

So, a basic Idle state that listens for the appropriate input action... then the state that that transitions to (what i'd do... may not be the best way though) would have a system that cycles every X seconds (probably every tenth of a second) and places a point or an empty game object (or adds a vector to an array using Arraymaker... but i'm still green on that one personally) and listens for the "mouse/touch up" event... and when you're done, you have a collection of points with which you can use to calculate a path.

However, I can see one possible issue... in the cycle, if there is a "mouse up" before that fires, that could cause the state to not recognize that it's lifted up... so, you could get around this with a monitor system that has the input being sent to a boolean value that each state listens for (in the "cycle" system) and when that boolean is "false" then it drops out of this. Or you could have the mouse/touch being controlled by a separate FSM that calls the actions there via the "Send event" action... and that send event could be calling global transitions in your "path" FSM...

So, let us know if any of this helps...

Justin

  • Junior Playmaker
  • **
  • Posts: 58
Re: Swiping Objects
« Reply #4 on: August 20, 2013, 11:42:46 PM »
Thanks for the well thought out reply Red I tried a few of your suggestions but still having trouble, I'm still working on this though and I'll post an update later of what I did once I get it to work.  I've been experimenting with the finger gestures plugin and I think I might be on the right track now.

Red

  • Hero Member
  • *****
  • Posts: 563
Re: Swiping Objects
« Reply #5 on: August 26, 2013, 08:14:13 PM »
Well, if it helps, try and develop it in steps.

Try getting the "touch down" system going so that when you press, it clicks over to the "Waiting for touch up" state... and make sure to register both points for where you touch down and when the up is called.

I think that the "Screen to world point" actions might help in this respect since you're going to be using a screen-space coordinates (unless you want to use a direct "mouse pick/raycast" action set) and just calculate those. However, I admit I'm green in this so what I'm suggesting might not be what you're needing.

But yeah, break it down into small steps/chunks and go from there. try and get the first set of actions in your first state going... then try and get the next ones... then build it up from there. That's one aspect that PM really shines since it's very, very easy to add-on to your functions.