Created
July 27, 2017 17:35
-
-
Save OrganumTechnology/c57a92ab2671e8e8e951abbed77fec44 to your computer and use it in GitHub Desktop.
_HeadTracking Script for Unity Gvr Cardboard (Advice needed to upgrade to Unity 5.6 GvrEditorEmulator or other new component)
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
//HeadTracking and UI for Gvr Cardboard | |
//Need to modify for Unity 5.6 new Release (for example, GvrViewerMain replaced by GvrEditorEmulator in new release) | |
using System.Collections; | |
using System.Collections.Generic; | |
using UnityEngine; | |
public class _HeadTracking : MonoBehaviour { | |
private Vector3[] anlges; | |
private int index; | |
private Vector3 centerAngle; | |
// Use this for initialization | |
void Start () { | |
angles = new Vector3[80]; | |
index = 0; | |
centerAngle = GvrViewer.Instance.HeadPose.Orientation.eulerAngles;//There is no longer a GvrViewer - Advice Appreciated | |
} | |
// Update is called once per frame | |
void Update () { | |
angles [index] = GvrViewer.Instance.HeadPose.Orientation.eulerAngles;//No longer a GvrViewer - Advice Appreciated | |
index++; | |
if (index == 80) { | |
} | |
} | |
void CheckMovement(){ //I would like to obtain a data file with Head Tracking coordinates re rather than up or down | |
bool right = false, left = false, up = false, down = false; | |
for (int i = 8; i < 80; i++); | |
if(anlges[i].x < centerAngle.x - 20.0f && !left); | |
left = true; | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
[Help] Old C# Unity script used for Gvr Cardboard set to GvrViewerMain will not compile as Unity 5.6 now has new components such as GvrEditorEmulator - Advice Appreciated