Skip to content

Instantly share code, notes, and snippets.

@ezesundayeze
Created August 25, 2016 15:10
Show Gist options
  • Save ezesundayeze/583a1867b523ecefbc0cfc75582a2a55 to your computer and use it in GitHub Desktop.
Save ezesundayeze/583a1867b523ecefbc0cfc75582a2a55 to your computer and use it in GitHub Desktop.
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);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment