예제 #1
0
        /// <summary>
        /// If a locked plug is grabbed, that means it was already connected to the socket and is now being unplugged
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="args"></param>
        protected override void OnLockedPlugGrabbed(object sender, InteractableObjectEventArgs args)
        {
            base.OnLockedPlugGrabbed(sender, args);
            LockedPlug.DisconnectFromDataEndpoint();

            snapToSocketRoutine = SnapToSocket();
            StartCoroutine(snapToSocketRoutine);
        }
예제 #2
0
        protected override void OnLockedPlugUngrabbed(object sender, InteractableObjectEventArgs args)
        {
            StopSnapping();
            LockedPlug.ConnectToDataEndpoint(plugReceptacle);

            plugAttach.transform.position = targetPosition;
            plugAttach.transform.rotation = targetRotation;
            LockedPlug.GetComponent <VRTK_TransformFollow>().gameObjectToFollow = plugAttach;
        }
예제 #3
0
        /// <summary>
        /// Moves the plug to the socket's connection point and connects the plug to the socket
        /// </summary>
        /// <returns></returns>
        private IEnumerator AutoPlugIntoTarget()
        {
            LockedPlug.DestinationEndpoint = plugReceptacle;
            StopSnapping();

            positionSnap.SnapToTarget(PlugConnectionPoint.position, 1f);

            while (!positionSnap.HasReachedTarget)
            {
                yield return(new WaitForEndOfFrame());
            }

            LockedPlug.ConnectToDataEndpoint(plugReceptacle);
            LockedPlug.GetComponent <VRTK_TransformFollow>().gameObjectToFollow = PlugConnectionPoint.gameObject;
            yield return(null);
        }