예제 #1
0
 void ACTION(VRInteractor hand)
 {
     if (target == null || item == null || hand.heldItem != item)
     {
         return;
     }
     _enabled = !_enabled;
     target.gameObject.SetActive(_enabled);
 }
예제 #2
0
 virtual public void OnEnable()
 {
     interactor = (VRInteractor)target;
     if (interactor.GetComponent <VRInput>() == null)
     {
         interactor.gameObject.AddComponent <VRInput>();
         EditorUtility.SetDirty(interactor);
         EditorSceneManager.MarkSceneDirty(SceneManager.GetActiveScene());
     }
 }
예제 #3
0
 void Update()
 {
     if (vrInteractor != null && vrInteractor.forceGrabDistance == (forceGrabOn ? defaultForceDistance : 0f))
     {
         return;
     }
     if (vrInteractor == null)
     {
         vrInteractor = GetComponent <VRInteractor>();
     }
     if (vrInteractor == null)
     {
         return;
     }
     vrInteractor.forceGrabDistance = forceGrabOn ? defaultForceDistance : 0f;
 }
예제 #4
0
        public void InputReceived(string method)
        {
            if (vrInteractor == null)
            {
                vrInteractor = GetComponent <VRInteractor>();
                if (vrInteractor == null)
                {
                    Debug.LogError("This script should be on the same object as a VRInteractor");
                    return;
                }
            }

            if (method == actionName)
            {
                forceGrabOn = true;
                vrInteractor.forceGrabDistance = defaultForceDistance;
            }
            else if (method == actionName + "Released")
            {
                forceGrabOn = false;
                vrInteractor.forceGrabDistance = 0f;
            }
        }