Skip to content

Instantly share code, notes, and snippets.

@the6th
Created December 24, 2020 12:24
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 the6th/4c8d7484d3555f2ebf84754523d9082d to your computer and use it in GitHub Desktop.
Save the6th/4c8d7484d3555f2ebf84754523d9082d to your computer and use it in GitHub Desktop.
HoloLensを0Dofにする
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