Example #1
0
        public virtual void BeginInteraction(NVRInteractable interactable)
        {
            if (interactable.CanAttach == true)
            {
                // Implemented hand controller should subscribe to this event and implement appropriate functionality
                OnBeginInteractionCustomHands.Invoke(interactable);

                CurrentlyInteracting = interactable;
                CurrentlyInteracting.BeginInteraction(this);

                if (PhysicalController)
                {
                    PhysicalController.On();        // enable animation with Phyiscal Hand component during interaction
                }

                if (OnBeginInteraction != null)
                {
                    OnBeginInteraction.Invoke(interactable);
                }
            }
        }
Example #2
0
        private void SetVisibility(VisibilityLevel visibility)
        {
            if (CurrentVisibility != visibility)
            {
                if (visibility == VisibilityLevel.Ghost)
                {
                    PhysicalController.Off();

                    for (int index = 0; index < GhostRenderers.Length; index++)
                    {
                        GhostRenderers[index].enabled = true;
                    }

                    for (int index = 0; index < GhostColliders.Length; index++)
                    {
                        GhostColliders[index].enabled = true;
                    }
                }

                if (visibility == VisibilityLevel.Visible)
                {
                    PhysicalController.On();

                    for (int index = 0; index < GhostRenderers.Length; index++)
                    {
                        GhostRenderers[index].enabled = false;
                    }

                    for (int index = 0; index < GhostColliders.Length; index++)
                    {
                        GhostColliders[index].enabled = false;
                    }
                }
            }

            CurrentVisibility = visibility;
        }
Example #3
0
        private void SetVisibility(VisibilityLevel visibility)
        {
            if (CurrentVisibility != visibility)
            {
                if (visibility == VisibilityLevel.Invisible)
                {
                    if (PhysicalController != null)
                    {
                        PhysicalController.Off();
                    }

                    if (Player.AutomaticallySetControllerTransparency == true)
                    {
                        for (int index = 0; index < GhostRenderers.Length; index++)
                        {
                            GhostRenderers[index].enabled = false;
                        }

                        for (int index = 0; index < GhostColliders.Length; index++)
                        {
                            GhostColliders[index].enabled = false;
                        }
                    }
                }

                if (visibility == VisibilityLevel.Ghost)
                {
                    if (PhysicalController != null)
                    {
                        PhysicalController.Off();
                    }

                    if (Player.AutomaticallySetControllerTransparency == true)
                    {
                        for (int index = 0; index < GhostRenderers.Length; index++)
                        {
                            GhostRenderers[index].enabled = true;
                        }

                        for (int index = 0; index < GhostColliders.Length; index++)
                        {
                            GhostColliders[index].enabled = true;
                        }
                    }
                }

                if (visibility == VisibilityLevel.Visible)
                {
                    if (PhysicalController != null)
                    {
                        PhysicalController.On();
                    }

                    if (Player.AutomaticallySetControllerTransparency == true)
                    {
                        for (int index = 0; index < GhostRenderers.Length; index++)
                        {
                            GhostRenderers[index].enabled = false;
                        }

                        for (int index = 0; index < GhostColliders.Length; index++)
                        {
                            GhostColliders[index].enabled = false;
                        }
                    }
                }
            }

            CurrentVisibility = visibility;
        }