Skip to content

Instantly share code, notes, and snippets.

@GOROman
Created October 7, 2017 13:42
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 GOROman/cb6b722494597a16624f54b76552b3c1 to your computer and use it in GitHub Desktop.
Save GOROman/cb6b722494597a16624f54b76552b3c1 to your computer and use it in GitHub Desktop.
[VR] Unityでカメラのリセンター処理
using UnityEngine;
public class VRRecenter : MonoBehaviour {
public KeyCode reloadKey = KeyCode.R; // このキーを押すとVR内のカメラ位置をリセンターする
// Update is called once per frame
void Update () {
if (Input.GetKeyDown(reloadKey))
{
print("Recenter!");
UnityEngine.VR.InputTracking.Recenter(); // Unity 5.x系
}
}
}
@GOROman
Copy link
Author

GOROman commented Oct 7, 2017

Unity 2017.2系だと
UnityEngine.XR.InputTracking.Recenter();

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment