Created
July 2, 2015 15:33
-
-
Save johro/7a37ac57e93000f3e92d 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 : Photon.MonoBehaviour { | |
private Rigidbody rb; | |
private float speed = 100; | |
// Use this for initialization | |
void Start () { | |
rb = GetComponent<Rigidbody>(); | |
} | |
// Update is called once per frame | |
void Update () { | |
if(photonView.isMine){ | |
float x = Input.GetAxis("Horizontal"); | |
float z = Input.GetAxis("Vertical"); | |
Vector3 move = new Vector3(x,0,z).normalized*Time.deltaTime*speed; | |
rb.velocity = move; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment