My character has the default script ThirdPersonController.js. I want to create a joystick on my screen which would enable it to move on touch screen. Whenever I import a joystick, it doesn’t allow me to control my character with it. How can I get the Input/Output of the joysticks? How can I maodify my ThirdPersonControlller sript to make the player move.? Please provide the whole code for both the Joystick.js and ThirdPersonCOntroller.js.
Thanks in advance.
Took me a while to figure out too. Open your TPC script and add this:
var moveJoystick : Joystick;
var XInput : float;
var YInput : float;
And in Awake () add this:
XInput = moveJoystick.position.x;
YInput = moveJoystick.position.y;
h = XInput;
v = YInput;
Then in the editor simply drag and drop your SIngle Joystick object onto the inspector variable for the ThirdPersonController. Worked for me, anyway.
Extremely easy and intuitive to use, Touch Controls Kit allows you to quickly and easily develop actions based on a touchscreen, buttonб joystick, touchpad dpad and tilt.