How could I do to recognize the gesture in the new GoogleVR sdk?
- How could I do to recognize the gesture in the new GoogleVR sdk?
It doesn't have GvrMain or GvrViewer like the olders and uses the unity's Main Camera.
I'm trying to do something like this:
https://www.youtube.com/watch?v=3icqAJnZF8Y
But instead of change the material color, I want to show and hide an image on screen like a help instruction.
Sorry about my english and thanks for the help!08-12-2018 07:56 PMLike 0 -
- Here is the code unchanged:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class NodRecognition : MonoBehaviour {
private Vector3[] angles;
private int index;
private Vector3 centerAngle;
public GameObject responsiveObject;
// Use this for initialization
void Start () {
ResetGesture();
}
// Update is called once per frame
void Update () {
angles[index] = GvrViewer.Instance.HeadPose.Orientation.eulerAngle s;
index++;
if(index == 80)
{
CheckMovement();
ResetGesture();
}
}
void CheckMovement()
{
bool right = false, left = false, up = false, down = false;
for (int i = 0; i < 80; i++)
{
if(angles[i].x < centerAngle.x - 20.0f && !up)
{
up = true;
}else if (angles[i].x > centerAngle.x + 20.0f && !down)
{
down = true;
}
if (angles[i].y < centerAngle.y - 20.0f && !left)
{
left = true;
}
else if (angles[i].y > centerAngle.y + 20.0f && !right)
{
right = true;
}
}
if (left && right &&!(up && down))
{
print("Response = No");
responsiveObject.GetComponent<Renderer>().material .color = Color.red;
}
if (up && down &&!(left && right))
{
print("Response = Yes");
responsiveObject.GetComponent<Renderer>().material .color = Color.green;
}
}
void ResetGesture()
{
angles = new Vector3[80];
index = 0;
centerAngle = GvrViewer.Instance.HeadPose.Orientation.eulerAngle s;
}
}
#ERROR : CS0103: The name 'GvrViewer' does not exist in the current contextpkcable likes this.08-13-2018 12:43 PMLike 1 - 08-13-2018 03:33 PMLike 0
- Forum
- VR Heads Community
- VR Developer's Lounge
How could I do to recognize the gesture in the new GoogleVR sdk?
« How to access the HP Windows Mixed Reality sensors/cameras for depth mapping?
|
Need software recommendation for 360 photo presentation »
LINK TO POST COPIED TO CLIPBOARD