Skip to content

Instantly share code, notes, and snippets.

@OrganumTechnology
Created July 27, 2017 17:35
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 OrganumTechnology/c57a92ab2671e8e8e951abbed77fec44 to your computer and use it in GitHub Desktop.
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)
//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;
}
}
@OrganumTechnology
Copy link
Author

[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

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