0

I am currently working on some Unity VR project and I have a problem with gaze functions. As an example I will use Google VR DemoScene object named Cube. There is a Teleport script attached with some gaze code at the end:

  public void OnGazeEnter() {
    SetGazedAt(true);
  }

  public void OnGazeExit() {
    SetGazedAt(false);
  }

  public void OnGazeTrigger() {
    TeleportRandomly();
  }

However this fragment seems to be useless and all gaze events are handled by EventTrigger component attached to the Cube object.

My question is - how do you handle gaze events (OnGazeEnter, OnGazeExit, OnGazeTrigger) with this code only? It would be way simpler not to attach EventTrigger component all the time.

Dorczenzo
  • 31
  • 5
  • Yesterday I wrote about the 3 types of Raycasts here. It should help you: http://answers.unity3d.com/answers/1200449/view.html On the other hand, I wonder what happens if you remove that code you say it useless. I mean, maybe the compiler will give you some warnings or errors tips. – chelder Jun 10 '16 at 22:51

1 Answers1

0

They are not useless, just not very well documented how to use it. It tooks me a while for me to figure out how to.

If you want to use them, what you need to do is remove the EvenTrigger component, then select the Main Camera and Add the component called "GVRGaze" and now these events are fired by code (OnGazeEnter, OnGazeExit, OnGazeTrigger)

You can use the mask to filter layers if you want, this is very helpful.

Hope this helps you.