Created
October 7, 2017 13:42
-
-
Save GOROman/cb6b722494597a16624f54b76552b3c1 to your computer and use it in GitHub Desktop.
[VR] Unityでカメラのリセンター処理
This file contains hidden or 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; | |
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系 | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Unity 2017.2系だと
UnityEngine.XR.InputTracking.Recenter();