Created
December 24, 2020 12:24
-
-
Save the6th/4c8d7484d3555f2ebf84754523d9082d to your computer and use it in GitHub Desktop.
HoloLensを0Dofにする
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; | |
/// <summary> | |
/// HoloLensを0Dofにする。 | |
/// <para>カメラの親要素(MixedRealityPlayspace)にAttachするスクリプト</para> | |
/// </summary> | |
public class DisableCameraTracking : MonoBehaviour | |
{ | |
Transform cacheCamera; | |
void Start() | |
{ | |
cacheCamera = Camera.main.transform; | |
//Positon Trackingを殺す rotationは残る | |
UnityEngine.XR.InputTracking.disablePositionalTracking = true; | |
} | |
void Update() | |
{ | |
transform.localRotation = Quaternion.Inverse(cacheCamera.localRotation); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment