1. otaviocesar's Avatar
    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 PM
  2. pkcable's Avatar
    08-13-2018 08:03 AM
  3. otaviocesar's Avatar
    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 context
    pkcable likes this.
    08-13-2018 12:43 PM
  4. pkcable's Avatar
    Hopefully one of my developer friends, that I shouted out will be along to try to help soon.
    08-13-2018 03:33 PM
LINK TO POST COPIED TO CLIPBOARD