Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: michaelgenn on March 02, 2015, 08:54:29 PM

Title: Swipe movement similar to the scroll rect
Post by: michaelgenn on March 02, 2015, 08:54:29 PM
I am working on a character selection scene and I am trying to create a swipe gesture that will allow a swipe left or right (on the x) similar to how the scroll rect swipe works.  Starts fast and comes to a slow stop.  I would use the UI and use scroll rect, but the objects I'm using are 3D.  I'm trying to get the whole Crossy Road look and feel.

Also, if someone knows a better way, I would love to hear it.

Thank you in advance!
Title: Re: Swipe movement similar to the scroll rect
Post by: 4ppleseed on March 03, 2015, 02:51:03 PM
You want to have a Float that starts at a certain number and counts down to zero.

Start with the Swipe Event Gesture and put in an event for Swipe Left

On Swipe left:
Use Set Float (set it to say 0.5) and save the float as a variable called 'scrollSpeed'.

Use the Float Add (and put in -0.1 and tick per second or per frame (try both, see what they do)

Then move the camera to the left with a speed of 'scrollSpeed'

It'll start moving at a speed of 0.5 then 0.4 then 0.3 then 0.2 then 0.1 and then come to a stop.

You'll need to mess with the values to get it to feel right. You could use Ease Float or Float Interpolate for a nicer movement.
Title: Re: Swipe movement similar to the scroll rect
Post by: michaelgenn on March 04, 2015, 06:48:16 PM
Thanks for the reply 4ppleseed.  I tried it a couple of ways, including yours.  I actually found that the Add Force action worked the best.

Thanks again for the reply!
Title: Re: Swipe movement similar to the scroll rect
Post by: 4ppleseed on March 05, 2015, 04:33:59 AM
Yep, that'll work too  8)