Player controller implemented.
This commit is contained in:
parent
e028cf854f
commit
609f4e9269
51 changed files with 1139 additions and 2 deletions
Binary file not shown.
22
Assets/Scripts/PlayerController.cs
Normal file
22
Assets/Scripts/PlayerController.cs
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
using UnityEngine;
|
||||
using System.Collections;
|
||||
|
||||
public class PlayerController : MonoBehaviour {
|
||||
|
||||
public float speed;
|
||||
|
||||
void Update() {
|
||||
|
||||
}
|
||||
|
||||
void FixedUpdate() {
|
||||
float moveHorizontal = Input.GetAxis ("Horizontal");
|
||||
float moveVertical = Input.GetAxis ("Vertical");
|
||||
|
||||
Vector3 movement = new Vector3 (moveHorizontal, 0.0f, moveVertical);
|
||||
|
||||
rigidbody.MovePosition (rigidbody.position + movement * speed * Time.deltaTime);
|
||||
|
||||
rigidbody.freezeRotation = true;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 251bece4d5a74464c8cd55c706ad3da2
|
||||
guid: 9f11a522c76fd7f47b5a384fe75b3cab
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
userData:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue