OnPointerEnter() public abstract method

public abstract OnPointerEnter ( RaycastResult, rayastResult, Ray, ray, bool isInteractive ) : void
rayastResult RaycastResult,
ray Ray,
isInteractive bool
return void
 /*public void OnInputModuleEnabled ()	{
  *      GazePointer.OnInputModuleEnabled ();
  * }
  *
  * public void OnInputModuleDisabled () {
  *      GazePointer.OnInputModuleEnabled ();
  * }
  */
 public void OnPointerEnter(RaycastResult rayastResult, bool isInteractive)
 {
     GazePointer.OnPointerEnter(rayastResult, isInteractive);
     if (isInteractive)
     {
         Target = rayastResult.gameObject;
     }
     else
     {
         Target = null;
     }
 }
Beispiel #2
0
 public void OnPointerEnter(GameObject targetObject, Vector3 intersectionPosition, Ray intersectionRay, bool isInteractive)
 {
     GazePointer.OnPointerEnter(targetObject, intersectionPosition, intersectionRay, isInteractive);
     if (isInteractive)
     {
         Target = targetObject;
     }
     else
     {
         Target = null;
     }
 }
Beispiel #3
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;
                }
            }
        }
    }