Jump to content

What is the start point of SRanipal_Eye.Focus?

Recommended Posts

  • 3 months later...


I think it is a bug.

The origin of the local variable "rayGlobal" should be the origin of the gaze rays (Left, Right, or Combined).

Manual fix of the Focus method:

public static bool Focus(GazeIndex index, out Ray ray, out FocusInfo focusInfo, float radius, float maxDistance, int focusableLayer, EyeData_v2 eye_data)
    bool valid = GetGazeRay(index, out ray, eye_data);
    if (valid)
        Ray rayGlobal = new Ray(
          Camera.main.transform.position + Camera.main.transform.rotation * ray.origin,
        RaycastHit hit;
        if (radius == 0) valid = Physics.Raycast(rayGlobal, out hit, maxDistance, focusableLayer);
        else valid = Physics.SphereCast(rayGlobal, radius, out hit, maxDistance, focusableLayer);
        focusInfo = new FocusInfo
            point = hit.point,
            normal = hit.normal,
            distance = hit.distance,
            collider = hit.collider,
            rigidbody = hit.rigidbody,
            transform = hit.transform
        focusInfo = new FocusInfo();
    return valid;


Edited by MasakiKitayama
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...