Skip to content

Instantly share code, notes, and snippets.

@johro
Created July 2, 2015 15:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save johro/7a37ac57e93000f3e92d to your computer and use it in GitHub Desktop.
Save johro/7a37ac57e93000f3e92d to your computer and use it in GitHub Desktop.
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