public virtual void UpdatePointers()

in Assets/MRTK/SDK/Features/UX/Scripts/Pointers/DefaultPointerMediator.cs [102:241]


        public virtual void UpdatePointers()
        {
            using (UpdatePointersPerfMarker.Auto())
            {
                // If there's any teleportation going on, disable all pointers except the teleporter
                foreach (IMixedRealityTeleportPointer pointer in teleportPointers)
                {
                    if (pointer.TeleportRequestRaised)
                    {
                        pointer.IsActive = true;

                        foreach (IMixedRealityPointer otherPointer in allPointers)
                        {
                            if (otherPointer.PointerId == pointer.PointerId)
                            {
                                continue;
                            }

                            otherPointer.IsActive = false;
                        }
                        // Don't do any further checks
                        return;
                    }
                }

                // pointers whose active state has not yet been set this frame
                unassignedPointers.Clear();
                foreach (IMixedRealityPointer unassignedPointer in allPointers)
                {
                    unassignedPointers.Add(unassignedPointer);
                }

                ApplyCustomPointerBehaviors();

                // If any pointers are locked, they have priority. 
                // Deactivate all other pointers that are on that input source
                foreach (IMixedRealityPointer pointer in allPointers)
                {
                    if (pointer.IsFocusLocked)
                    {
                        pointer.IsActive = true;
                        unassignedPointers.Remove(pointer);

                        if (pointer.InputSourceParent != null)
                        {
                            foreach (IMixedRealityPointer otherPointer in pointerByInputSourceParent[pointer.InputSourceParent])
                            {
                                if (!unassignedPointers.Contains(otherPointer))
                                {
                                    continue;
                                }

                                otherPointer.IsActive = false;
                                unassignedPointers.Remove(otherPointer);
                            }
                        }
                    }
                }

                // Check for near and far interactions
                // Any far interact pointers become disabled when a near pointer is near an object
                foreach (IMixedRealityNearPointer pointer in nearInteractPointers)
                {
                    if (!unassignedPointers.Contains(pointer))
                    {
                        continue;
                    }

                    if (pointer.IsNearObject)
                    {
                        pointer.IsActive = true;
                        unassignedPointers.Remove(pointer);

                        if (pointer.InputSourceParent != null)
                        {
                            foreach (IMixedRealityPointer otherPointer in pointerByInputSourceParent[pointer.InputSourceParent])
                            {
                                if (!unassignedPointers.Contains(otherPointer))
                                {
                                    continue;
                                }

                                if (otherPointer is IMixedRealityNearPointer)
                                {
                                    // Only disable far interaction pointers
                                    // It is okay for example to have two near pointers active on a single controller
                                    // like a poke pointer and a grab pointer
                                    continue;
                                }

                                otherPointer.IsActive = false;
                                unassignedPointers.Remove(otherPointer);
                            }
                        }
                    }
                }

                // Check for far interactions
                // Any far pointer other than GGV has priority over GGV
                foreach (IMixedRealityPointer pointer in farInteractPointers)
                {
                    if (!unassignedPointers.Contains(pointer))
                    {
                        continue;
                    }

                    if (!(pointer is GGVPointer))
                    {
                        pointer.IsActive = true;
                        unassignedPointers.Remove(pointer);

                        if (pointer.InputSourceParent != null)
                        {
                            foreach (IMixedRealityPointer otherPointer in pointerByInputSourceParent[pointer.InputSourceParent])
                            {
                                if (!unassignedPointers.Contains(otherPointer) || !farInteractPointers.Contains(otherPointer))
                                {
                                    continue;
                                }

                                if (otherPointer is GGVPointer)
                                {
                                    // Disable the GGV pointer of an input source
                                    // when there is another far pointer belonging to the same source
                                    otherPointer.IsActive = false;
                                    unassignedPointers.Remove(otherPointer);
                                }
                            }
                        }
                    }
                }

                // All other pointers that have not been assigned this frame
                // have no reason to be disabled, so make sure they are active
                foreach (IMixedRealityPointer unassignedPointer in unassignedPointers)
                {
                    unassignedPointer.IsActive = true;
                }
            }
        }