Hi,
I am trying to use SRanipal SDK. I would like to detect which object that is being looked at. By just returning the name of objects that are being looked at should be fine with me. Could anyone give me a hand please ? I am trying to look at the sample script but could not really get it.
Here is the script that I call from Update function in UNITY
using Photon.Pun;
using System;
using System.IO;
using UnityEngine;
using ViveSR.anipal.Eye;
void Update()
{
CheckFocus();
}
public void CheckFocus()
{
Ray GazeRay;
bool eyeFocus;
if (SRanipal_Eye.Focus(GazeIndex.COMBINE, out GazeRay, out focusInfo)) { }
else if (SRanipal_Eye.Focus(GazeIndex.RIGHT, out GazeRay, out focusInfo)) { }
else if (SRanipal_Eye.Focus(GazeIndex.LEFT, out GazeRay, out focusInfo)) { }
else return;
var currentFocusObject = focusInfo.collider.gameObject.name;
}
Kindly see the error that I have got.
NullReferenceException: Object reference not set to an instance of an object
ViveSR.anipal.Eye.SRanipal_Eye.Focus (ViveSR.anipal.Eye.GazeIndex index, UnityEngine.Ray& ray, ViveSR.anipal.Eye.FocusInfo& focusInfo, System.Single radius, System.Single maxDistance, System.Int32 focusableLayer, ViveSR.anipal.Eye.EyeData eye_data) (at Assets/ViveSR/Scripts/Eye/SRanipal_Eye.cs:357)
ViveSR.anipal.Eye.SRanipal_Eye.Focus (ViveSR.anipal.Eye.GazeIndex index, UnityEngine.Ray& ray, ViveSR.anipal.Eye.FocusInfo& focusInfo, ViveSR.anipal.Eye.EyeData eye_data) (at Assets/ViveSR/Scripts/Eye/SRanipal_Eye.cs:462)
ViveSR.anipal.Eye.SRanipal_Eye.Focus (ViveSR.anipal.Eye.GazeIndex index, UnityEngine.Ray& ray, ViveSR.anipal.Eye.FocusInfo& focusInfo) (at Assets/ViveSR/Scripts/Eye/SRanipal_Eye.cs:475)
EyeInfo.CheckFocus () (at Assets/Scripts/EyeInfo.cs:180)
EyeInfo.Update () (at Assets/Scripts/EyeInfo.cs:63)
Thanks