- Home /
Question by
Deathcrew · Nov 14, 2016 at 07:35 AM ·
scripting beginner
GetAxis to GetTouch
hello everybody... im new and i start learn unity with their lessons !!! On first project of unity, Roll a Ball, it give me a this code:
using UnityEngine;
using System.Collections;
public class PlayerController : MonoBehaviour {
public float speed;
private Rigidbody rb;
void Start ()
{
rb = GetComponent<Rigidbody>();
}
void FixedUpdate ()
{
float moveHorizontal = Input.GetAxis ("Horizontal");
float moveVertical = Input.GetAxis ("Vertical");
Vector3 movement = new Vector3 (moveHorizontal, 0.0f, moveVertical);
rb.AddForce (movement * speed);
}
}
If i replace Input.GetAxis with Input.GetTouch their not work... how i can fix the code for try the project on my device Android and continue the lessons of unity? I prefeer modify the code, because i understand it with unity lessons... thanks so much to all!
Comment