playMaker

Author Topic: Help with virtual joystick  (Read 340 times)

bazzajunior

  • Playmaker Newbie
  • *
  • Posts: 25
    • View Profile
    • Molber Games
Help with virtual joystick
« on: June 06, 2019, 04:28:51 PM »
I'm using the Playmaker Virtual Joystick (working surprisingly well for something that was designed for Unity 5) for controlling a top-down pseudo 2D game involving a vehicle but can't get my head around how to get the X and Y axis to convert to a 360 rotation.

At present I have the game setup so that when the player clicks or holds down the joystick, motorTorque is applied to the all of the wheels and the vehicle moves forwards. My aim is that when the joystick is moved around its circumference, the vehicle will rotate to a similar direction. I just can't get my head around the necessary float/multiply/rotate or any other maths necessary to (e.g. to convert 0 to 1 and -0 to -1 into something useful like 0-360 degrees).

I have a similar setup for an touch and drag input on another game (i.e. forward torque applied and the tank rotates to look at the players finger) and would love to get a similar setup working here.

If anyone knows of a way to do this or can direct me to any tutorials would be highly appreciated.

Thanks in advance