void ACTION(VRInteractor hand) { if (target == null || item == null || hand.heldItem != item) { return; } _enabled = !_enabled; target.gameObject.SetActive(_enabled); }
virtual public void OnEnable() { interactor = (VRInteractor)target; if (interactor.GetComponent <VRInput>() == null) { interactor.gameObject.AddComponent <VRInput>(); EditorUtility.SetDirty(interactor); EditorSceneManager.MarkSceneDirty(SceneManager.GetActiveScene()); } }
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; }
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; } }