예제 #1
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;
        }
예제 #2
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);
        }