Hi, guys. I’m totally a beginner. My problem is that i;m making a first person view 3d game, but i can’t make it work on android. The game is already done, the only problem is the controller. I am using now the firstpersoncontroller that comes with unity assets. However, it works on pc with keys an mouse, but it is normal that it won’t work on touch devices. I want a joystick for movement and a touchpad for the view. How to do that ? I search on the asset store and i found the CNcontroller. It comes with :“everything” i need, but i can’t make it work. I understand that i need to input the axes and i don’t know how. Could anyone help me, please ?
Hi,
You can use the GetAxis method of the CNJoystick or CNTouchpad components.
using UnityEngine;
using System.Collections;
public class CNTest : MonoBehaviour {
CNTouchpad touchpad;
void Awake ()
{
touchpad = GameObject.Find ("CNTouchpad").GetComponent<CNTouchpad>();
}
void Update ()
{
print("TOUCHPAD: (" + touchpad.GetAxis ("Horizontal") + " , " + touchpad.GetAxis ("Vertical") + ")");
}
}