playMaker

Author Topic: left/right slide touch control  (Read 824 times)

Ronnie gaikwad

  • Playmaker Newbie
  • *
  • Posts: 22
left/right slide touch control
« on: May 30, 2020, 07:21:25 AM »
Hi I'm trying to have a continuous left/right touch control for mobile and i use control freak 2. So basically I replaced Get axis with Cf2 get axis and stores it multiplier in a variable 'X'
and use that value for X in set velocity in the same state. both the actions are every frame. what's happening is the character goes left/right when i drag my finger but doesn't stops when stop dragging finger intsead keeps on going left/right.I want the player to stop when i stop dragging my finger.
Important: The game will always need the finger to stay in touch.because it needs continuous left right movement.
Reference video

« Last Edit: May 30, 2020, 07:23:04 AM by Ronnie gaikwad »

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7616
    • jinxtergames
Re: left/right slide touch control
« Reply #1 on: May 30, 2020, 11:36:12 AM »
Hi.
i do not have the asset.

but i think you need to get the touch position and then use screen to world point
to position the ball.
you could have a empty object to follow that position and then let ball smooth follow.

dpomza

  • Playmaker Newbie
  • *
  • Posts: 2
Re: left/right slide touch control
« Reply #2 on: May 31, 2020, 04:01:59 AM »
I'm not sure if I understand correctly but I would add another state with "Touch event" where you can set the touch phase to "touch ended" thus triggering moving on to the idle state.

(and in the idle state set the velocity to zero. Or ease it to zero using floats)
« Last Edit: May 31, 2020, 04:03:48 AM by dpomza »

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7616
    • jinxtergames
Re: left/right slide touch control
« Reply #3 on: May 31, 2020, 06:16:16 AM »
Hi,
I would not use velocity at all.

Just get the touch position (x) and set that position to the object.

Screen to world point will convert the screen position to the world position, so the object would be on the position where you finger/mouse is.

But to have some delay on it i would set that position (x) on another object and let the ball follow that object with for example smooth follow.