Question by
makingbuzzman · Jun 11, 2016 at 06:21 PM ·
controller
I just started using Unity and while doing the tutorials for rolling the ball which is step 2, I wasn't able to move my ball in Monodevelop
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);
}
}
Comment
Your answer
