mrk88 Posted July 15, 2019 Share Posted July 15, 2019 Hi all, I've just got my hands on the Vive Pro and like to get some gaze data out of it in Unity. I notice that in SRapinal_eye.cs all the functions are boolean. Can somebody tell me how can I get some gaze position data and other gaze features (such as timestamp and pupil position , etc ) in my own c# file? Link to comment Share on other sites More sharing options...
Corvus Posted July 15, 2019 Share Posted July 15, 2019 Here's some sample code to help you get started in Unity. private static EyeData eyeData;private static VerboseData verboseData;private float pupilDiameterLeft, pupilDiameterRight;private Vector2 pupilPositionLeft, pupilPositionRight;private float eyeOpenLeft, eyeOpenRight;void Update(){ SRanipal_Eye.GetEyeData(ref eyeData); SRanipal_Eye.GetVerboseData(out verboseData); // pupil diameter pupilDiameterLeft = eyeData.verbose_data.left.pupil_diameter_mm; pupilDiameterRight = eyeData.verbose_data.right.pupil_diameter_mm; // pupil positions pupilPositionLeft = eyeData.verbose_data.left.pupil_position_in_sensor_area; pupilPositionRight = eyeData.verbose_data.right.pupil_position_in_sensor_area; // eye open eyeOpenLeft = eyeData.verbose_data.left.eye_openness; eyeOpenRight = eyeData.verbose_data.right.eye_openness;} Link to comment Share on other sites More sharing options...
mrk88 Posted July 16, 2019 Author Share Posted July 16, 2019 Great, Thanks! So this code return all zero values. Do I need to do anything before getting these data? Link to comment Share on other sites More sharing options...
Corvus Posted July 16, 2019 Share Posted July 16, 2019 Do you have "SRanipal_Eye_Framework.cs" attached to a game object in the scene with "Enable Eye" checked? Link to comment Share on other sites More sharing options...
Cliona Posted February 11, 2020 Share Posted February 11, 2020 Hi, I'm just wondering whether having the "SRanipal_Eye_Framework" attached to a game object with "Enable Eye" was your issue with this? I have all of that done, and included the above script and still get zero values in my Debug.Log. I'm very new to Unity, sorry if my question is simple. Thank you in advance. Link to comment Share on other sites More sharing options...
alwyuyang Posted February 11, 2020 Share Posted February 11, 2020 (edited) On 7/15/2019 at 6:45 PM, Corvus said: Here's some sample code to help you get started in Unity. private static EyeData eyeData;private static VerboseData verboseData;private float pupilDiameterLeft, pupilDiameterRight;private Vector2 pupilPositionLeft, pupilPositionRight;private float eyeOpenLeft, eyeOpenRight;void Update(){ SRanipal_Eye.GetEyeData(ref eyeData); SRanipal_Eye.GetVerboseData(out verboseData); // pupil diameter pupilDiameterLeft = eyeData.verbose_data.left.pupil_diameter_mm; pupilDiameterRight = eyeData.verbose_data.right.pupil_diameter_mm; // pupil positions pupilPositionLeft = eyeData.verbose_data.left.pupil_position_in_sensor_area; pupilPositionRight = eyeData.verbose_data.right.pupil_position_in_sensor_area; // eye open eyeOpenLeft = eyeData.verbose_data.left.eye_openness; eyeOpenRight = eyeData.verbose_data.right.eye_openness;} Why don't you create a subthread to read and send the data so that to have the data with 120 Hz? Did you try that (I fail to do that because I don't know how to manage the thread in Unity3d). Thank you if you have any ideas. Edited February 11, 2020 by alwyuyang Link to comment Share on other sites More sharing options...
Corvus Posted February 11, 2020 Share Posted February 11, 2020 @alwyuyang Please see this thread for a sample of reading data at 120hz with threads: https://forum.vive.com/topic/5897-getting-verbosedata-at-the-fastest-rate-possible/?do=findComment&comment=26428 Link to comment Share on other sites More sharing options...
alwyuyang Posted February 11, 2020 Share Posted February 11, 2020 On 2/12/2020 at 3:53 AM, Corvus said: @alwyuyang Please see this thread for a sample of reading data at 120hz with threads: https://forum.vive.com/topic/5897-getting-verbosedata-at-the-fastest-rate-possible/?do=findComment&comment=26428 I tried with that code, but I cannot close my application when it should be closed( like crash) . Do you have any updated version which can overcome this problem? Thank you very much. @Corvus Link to comment Share on other sites More sharing options...
xumy Posted September 2, 2021 Share Posted September 2, 2021 Hello, I would like to ask where this sample code is added? @Corvus Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now