Jump to content
 
AdamStreck

Getting Screen Position of the Gaze in Unity

Recommended Posts

I'm trying to display a UI element in the position of the gaze collision. I found out that just using:

Camera.main.WorldToScreenPoint(collision.position, Camera.MonoOrStereoscopicEye.Left);

does not fully work for the "LeftEye" display - there seems to be some screen-cropping going on (about 15% on each side). 

Does anybody have a way how to reliably obtain a screenpoint from world point in SteamVR in Unity please?

@Daniel_Y @Corvus
 

Share this post


Link to post
Share on other sites

Hi @AdamStreck I'm running into similar issues, did you ever resolve this problem? 

Share this post


Link to post
Share on other sites

@AdamStreck @Av Can you clarify what you're trying to do? Are you trying to get a UI element intersection position (local canvas space) from a worldspace coordinate?

ui.GetComponent<RectTransform>().InverseTransformPoint(focusInfo.point).ToString();

 

Share this post


Link to post
Share on other sites

Hi @Corvus

I am trying to save eye position in screen coordinates (where the observer is looking in the scene in X,Y,Z pixels) for an analysis. For now I've been trying to raycast to get a hit point with world geometry, and to then convert that hit point to screen coordinates, but the values I'm getting seem off. 

When I tried going over the documentation, I didn't think focusInfo was quite what I needed. I looked again and I'm still unsure, can you clarify what focusInfo.point is? 

Thanks so much for your help!

Avi 

 

Share this post


Link to post
Share on other sites

Hi @Hank_Li,

Thanks for the idea! I think I've figured it out, it didn't end up being a calibration problem, it was an issue with the input to WorldToScreenPoint.

Share this post


Link to post
Share on other sites

Please sign in to comment

You need to be a member in order to leave a comment

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...