playMaker

Author Topic: Touch Move like Shooty Skies?  (Read 1498 times)

velocitygames

  • Playmaker Newbie
  • *
  • Posts: 2
Touch Move like Shooty Skies?
« on: June 30, 2020, 04:24:02 PM »
How can I make the movement like in Shooty skies. I simply want to be able to drag around the screen to move the player (on mobile with touch)

Thanks!

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15620
  • Official Playmaker Support
Re: Touch Move like Shooty Skies?
« Reply #1 on: July 01, 2020, 01:50:18 AM »
Hi,

do you have a character controller that you can control using a direction vector? that's the first thing to setup, the direction vector can be controlled manually from the inspector to begin with.

 the second step is to deduce the direction from the touch on the ground relative from the player position. To do this,  you can raycast the touch to your terrain, you end up with the end tip of the direction, you then substract that from the player current position, you normalize it and you have the direction your player should move towards.

Bye,

 Jean

velocitygames

  • Playmaker Newbie
  • *
  • Posts: 2
Re: Touch Move like Shooty Skies?
« Reply #2 on: July 01, 2020, 04:19:35 PM »
Thanks for your reply, I just started using playmaker and unity a couple days ago so I am most definitely a noob. Could you clarify how I could do this, I added the character controller component to my player but I don't know how to do the direction vector and raycast thing.

Thanks!

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15620
  • Official Playmaker Support
Re: Touch Move like Shooty Skies?
« Reply #3 on: July 03, 2020, 02:01:29 AM »
Hi,

 you need to experiment with each feature in isolation.

- raycasting, try to raycast from the a mouse click and place a gameobjecton the hit point in the scene, that's how you start with this. the action "mousepick" would be a simple start but it hides a lot of the complexity so that you fully understand raycasting

- for deducing direction, try with two simple gameobject, and get the direction between the two ( end position - start position, then normalize that), use actions like Vector3Operator, Vector3Normalize. then using that vector, try to move a third object along that direction to verify it's correct. then you will replace the start and end gameobject with your player position and mouse click raycast hit point.


work in small steps to acquire the basics, what you are asking is not trivial and you need to assimilate lots of concepts, within Unity, within 3d world in general and in playmaker.

Bye,

 Jean