Пример #1
0
        void TeleportInteractables()
        {
            NVRInteractable LHandInteractable = Player.LeftHand.CurrentlyInteracting;
            NVRInteractable RHandInteractable = Player.RightHand.CurrentlyInteracting;

            if (LHandInteractable != null)
            {
                DoNotTeleportObject LTO = LHandInteractable.transform.gameObject.GetComponent <DoNotTeleportObject> ();
                if (LTO == null || LTO.DoTeleport)
                {
                    if (LTO != null && LTO.IsBeschleuniger)
                    {
                        Beschleuniger b = LHandInteractable.transform.gameObject.GetComponentInChildren <Beschleuniger> ();

                        if (b.munition != null)
                        {
                            for (int i = 0; i < b.munition.Length; i++)
                            {
                                b.munition[i].rigidbody.MovePosition(b.munition[i].rigidbody.position + relPosition);
                            }
                            //b.munition.MovePosition(b.munition.position + relPosition);
                            //b.munition.velocity = Vector3.zero;
                        }
                    }
                    LHandInteractable.transform.position += relPosition;
                }
            }
            if (RHandInteractable != null)
            {
                DoNotTeleportObject RTO = RHandInteractable.transform.gameObject.GetComponent <DoNotTeleportObject> ();
                if (RTO == null || RTO.DoTeleport)
                {
                    if (RTO != null && RTO.IsBeschleuniger)
                    {
                        Beschleuniger b = RHandInteractable.transform.gameObject.GetComponentInChildren <Beschleuniger> ();

                        if (b.munition != null)
                        {
                            for (int i = 0; i < b.munition.Length; i++)
                            {
                                b.munition[i].rigidbody.MovePosition(b.munition[i].rigidbody.position + relPosition);
                            }
                            //b.munition.MovePosition(b.munition.position + relPosition);
                            //b.munition.velocity = Vector3.zero;
                        }
                    }
                    //RHandInteractable.transform.position = Player.RightHand.transform.position;
                    RHandInteractable.transform.position += relPosition;
                }
            }
        }
Пример #2
0
        void TeleportInteractables()
        {
            NVRInteractable LHandInteractable = Player.LeftHand.CurrentlyInteracting;
            NVRInteractable RHandInteractable = Player.RightHand.CurrentlyInteracting;

            if (LHandInteractable != null)
            {
                DoNotTeleportObject LTO = LHandInteractable.transform.gameObject.GetComponent <DoNotTeleportObject> ();
                if (LTO == null || LTO.DoTeleport)
                {
                    LHandInteractable.transform.position = Player.LeftHand.transform.position;
                }
            }
            if (RHandInteractable != null)
            {
                DoNotTeleportObject RTO = RHandInteractable.transform.gameObject.GetComponent <DoNotTeleportObject> ();
                if (RTO == null || RTO.DoTeleport)
                {
                    RHandInteractable.transform.position = Player.RightHand.transform.position;
                }
            }
        }