Created
August 25, 2016 15:10
-
-
Save ezesundayeze/583a1867b523ecefbc0cfc75582a2a55 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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