GetPointerRadius() public abstract method

public abstract GetPointerRadius ( float &enterRadius, float &exitRadius ) : void
enterRadius float
exitRadius float
return void
 public void GetPointerRadius(out float innerRadius, out float outerRadius)
 {
     GazePointer.GetPointerRadius(out innerRadius, out outerRadius);
 }
Esempio n. 2
0
    private void HandleGaze()
    {
        // Retrieve GazePointer radius.
        float innerRadius = 0.0f;
        float outerRadius = 0.0f;

        if (pointer != null)
        {
            pointer.GetPointerRadius(out innerRadius, out outerRadius);
        }

        // Find what object the user is looking at.
        Vector3           intersectPosition;
        IGvrGazeResponder target = null;
        Ray        intersectionRay;
        GameObject targetObject = FindGazeTarget(innerRadius, out target, out intersectPosition, out intersectionRay);

        // Found a target?
        if (targetObject != null)
        {
            lastIntersectPosition = intersectPosition;
            lastIntersectionRay   = intersectionRay;

            // Is the object new?
            if (targetObject != currentGazeObject)
            {
                if (pointer != null)
                {
                    pointer.OnPointerExit(currentGazeObject);
                }
                if (currentTarget != null)
                {
                    // Replace with current object.
                    currentTarget.OnGazeExit();
                }

                // Save new object.
                currentTarget     = target;
                currentGazeObject = targetObject;

                // Inform pointer and target of gaze.
                if (pointer != null)
                {
                    pointer.OnPointerEnter(currentGazeObject, intersectPosition,
                                           intersectionRay, currentTarget != null);
                }
                if (currentTarget != null)
                {
                    currentTarget.OnGazeEnter();
                }
            }
            else
            {
                // Same object, inform pointer of new intersection.
                if (pointer != null)
                {
                    pointer.OnPointerHover(currentGazeObject, intersectPosition,
                                           intersectionRay, currentTarget != null);
                }
            }
        }
        else
        {
            // Failed to find an object by inner radius.
            if (currentGazeObject != null)
            {
                // Already gazing an object? Check against outer radius.
                if (IsGazeNearObject(outerRadius, currentGazeObject, out intersectPosition))
                {
                    // Still gazing.
                    if (pointer != null)
                    {
                        pointer.OnPointerHover(currentGazeObject, intersectPosition,
                                               intersectionRay, currentTarget != null);
                    }
                }
                else
                {
                    // No longer gazing any object.
                    if (pointer != null)
                    {
                        pointer.OnPointerExit(currentGazeObject);
                    }
                    if (currentTarget != null)
                    {
                        currentTarget.OnGazeExit();
                    }
                    currentTarget     = null;
                    currentGazeObject = null;
                }
            }
        }
    }