Skip to content

Instantly share code, notes, and snippets.

@soyliquid
Last active August 29, 2015 14:10
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 soyliquid/e6574c30650092e2b4f9 to your computer and use it in GitHub Desktop.
Save soyliquid/e6574c30650092e2b4f9 to your computer and use it in GitHub Desktop.
[Unity][Photon][Oculus]プレイヤー制御用
using UnityEngine;
using System.Collections;
/// <summary>
/// Organze scripts for Photon usage.
/// </summary>
public class PhotonPlayerManager : Photon.MonoBehaviour {
public Transform CameraPosition;
public MonoBehaviour[] OwnerBehaviors;
public RelativeTransform LookPoint;
// Use this for initialization
void Start () {
if(photonView.isMine) {
// when player is mine, set camera and lookpoint.
Camera.main.transform.parent = CameraPosition.transform;
LookPoint.TargetPosition = GameObject.FindWithTag("LookPoint");
} else {
foreach(MonoBehaviour b in OwnerBehaviors){
// when player is not mine, disable registered scripts.
b.enabled = false;
}
}
}
// Update is called once per frame
void Update () {
if(Input.GetKeyDown(KeyCode.R)) {
OVRManager.display.RecenterPose();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment