Guys, hello I am using template from UNITY - microgame FPS.
I WANT TO ADD MOBILE CONTROLS instead of WASD. PLEASE HELP!!!,Hello guys, I am using standard template from Unity and NOW I WANT TO ADD MOBILE TOUCH CONTROLLER? HOW TO SWITCH MY WASD CONTROLLER TO TOUCH SCREEN.
Please recommend some assets and how to fix it. Video will be also ok.
Thank you.
@xenchukworker
There is a asset on the asset store Joystick Pack. Here are some steps you have to do-
-
After you have downloaded the asset add a canvas.
-
Take a joystick from the pack and make it a child of the canvas.
-
Place the joystick wherever you want and make it scale down or up by your preference.
-
(I believe that in your movement script you are moving the player by using this
if (someVariable >= Input.GetAxis("Horizontal"))
{
rigidBody.velocity = whatever you have;
}
The next step is to make a variable of type Joystick and then if you want that the character should not move slowly when joystick is moved a bit. For instance in the joystick when we move the inner circle the character will move, but there is a bigger circle in which the inner circle can be moved the inner circle cannot come out of the bigger circle but if you move the inner circle in between it’s original point (this means the center) and the bounds of the outer/bigger circle (this applies to all directions) the character will move slowly. To fix this you have to write these lines of code.
if (theNameOfTheJoystickVariable.Horizontal >= 0.3f)
{
//0.3f is just an example
someVariable = maxRunSpeed
//the someVariable is from the above
}
else if (theNameOfTheJoystickVariable <= -0.3f)
{
someVariable = -maxRunSpeed
}
else
{
someVariable = 0f;
}
I hope this would help ;O)