public void OnHoveredOut(VRInteractor interactor) { if (OnHoveredOutEvent != null) { OnHoveredOutEvent.Invoke(interactor); } }
void OnStopInteracting(VRInteractor interactor) { foreach (var m in interactor.GetComponentsInChildren <MeshRenderer>()) { m.enabled = true; } }
public void OnInteractionStart(VRInteractor interactor) { if (OnInteractionStartEvent != null) { OnInteractionStartEvent.Invoke(interactor); } }
public void SwitchLoco(LocoType newLocoType, bool tellOtherHand = true) { _currentType = newLocoType; _teleporter.enabled = newLocoType == LocoType.ARCTELEPORTER; _smooth.enabled = newLocoType == LocoType.SMOOTH; if (!tellOtherHand || _interactor == null) { return; } VRInteractor otherHand = _interactor.GetOtherController(); if (otherHand == null) { return; } VRLocomotionSwitcher otherLocoSwitch = otherHand.GetComponent <VRLocomotionSwitcher>(); if (otherLocoSwitch == null) { return; } otherLocoSwitch.SwitchLoco(newLocoType, false); }
void UpdateHandling() { if (handler != null) { VRInteractor interactor = handler.GetComponentInParent <VRInteractor>(); if (interactor.VRInput != null) { if (Vector3.Distance(lastTriggerPosition, sliderNode.transform.localPosition) > 0.005f) { lastTriggerPosition = sliderNode.transform.localPosition; interactor.VRInput.TriggerHapticPulse((ushort)(1000f * Mathf.Abs(SlideValue))); } } Vector3 dir = (rightNode.position - leftNode.position) / 2; Vector3 handleDiff = handler.position - startHandlingPosition; float d = Vector3.Dot(dir.normalized, handleDiff); d /= dir.magnitude; SlideValue = d + startValue; } else { if (!freeLoose) { SlideValue = Mathf.Lerp(SlideValue, stableSlideValue, Time.deltaTime * 8f); } } }
public void OnInteractionFinished(VRInteractor interactor) { if (OnInteractionFinishedEvent != null) { OnInteractionFinishedEvent.Invoke(interactor); } }
void ACTION(VRInteractor hand) { if (_item == null || hand.heldItem != _item) { return; } _audioSource.Play(); }
void OnStopInteracting(VRInteractor interactor) { if (currentInteractor == interactor) { currentInteractor = null; target = null; } }
void OnStopInteracting(VRInteractor interactor) { if (mInteractor != interactor) { return; } mInteractor = null; }
private void OnHoverIn(VRInteractor interactor) { if (interactor != null) { interactor.TriggerVibFeedback(1000); } isHovering = true; }
private void OnHoverIn(VRInteractor interactor) { if (interactor.VRInput != null) { interactor.VRInput.TriggerHapticPulse(1000); } isHovering = true; }
void OnStartInteracting(VRInteractor interactor) { if (currentInteractor == null) { currentInteractor = interactor; target = interactor.acquirePoint; } }
private void InteractingStop(VRInteractor interactor) { if (interactor != hoverInteractor) { return; } //Highlight Highlight(); }
void OnStartInteracting(VRInteractor interactor) { if (!VRPlayer.Instance.IsUsingSimulator) { foreach (var m in interactor.GetComponentsInChildren <MeshRenderer>()) { m.enabled = false; } } }
private void InteractingStart(VRInteractor interactor) { if (interactor != hoverInteractor) { return; } //Dehighlight Dehighlight(); }
private void OnHoverOut(VRInteractor interactor) { if (interactor != hoverInteractor) { return; } hoverInteractor = null; //Dehighlight Dehighlight(); }
private void OnHoverIn(VRInteractor interactor) { if (hoverInteractor != null) { return; } hoverInteractor = interactor; //Highlight Highlight(); }
void OnStartInteracting(VRInteractor interactor) { if (mInteractor != null) { return; } relativePosition = interactor.acquirePoint.InverseTransformPoint(transform.position); relativeRotation = Quaternion.Inverse(interactor.acquirePoint.rotation) * transform.rotation; mInteractor = interactor; }
void OnButtonClick(VRInteractor interactor) { if (triggerEffectFsm != null) { triggerEffectFsm.SendEvent("Trigger"); } if (onClick != null) { onClick.Invoke(); } }
void OnStopInteracting(VRInteractor interactor) { if (mInteractor != interactor) { return; } mInteractor = null; if (!string.IsNullOrEmpty(dropEvent)) { GlobalEventManager.SendEvent(dropEvent); } }
void OnStartInteracting(VRInteractor interactor) { if (handler != null) { return; } if (mSlider != null) { mSlider.Show(); mSlider.StartHandle(interactor.acquirePoint); handler = interactor.acquirePoint; } }
void OnStopInteracting(VRInteractor interactor) { if (handler == null || handler != interactor.acquirePoint) { return; } if (mSlider != null) { mSlider.Hide(); mSlider.StopHandle(); handler = null; } }
private void InteractionStop(VRInteractor interactor) { isToggleOn = !isToggleOn; if (isToggleOn) { OnToggleOn(); } else { OnToggleOff(); } this.interactor = null; }
void OnStartInteracting(VRInteractor interactor) { if (mInteractor != null) { return; } relativePosition = interactor.acquirePoint.InverseTransformPoint(transform.position); relativeRotation = Quaternion.Inverse(interactor.acquirePoint.rotation) * transform.rotation; mInteractor = interactor; if (!string.IsNullOrEmpty(pickEvent)) { GlobalEventManager.SendEvent(pickEvent); } }
// Update is called once per frame void Update() { if (head == null) { return; } UpdateHeadRot(); UpdateHeadPos(); //Special Process for Teleporting Teleporter teleporter = GetComponentInChildren <Teleporter>(); VRInteractor interactor = GetComponentInChildren <VRInteractor>(); if (Input.GetMouseButton(1)) { FreezeView(); if (teleporter != null) { Vector3 localEuler = teleporter.transform.localEulerAngles; float rotationX = localEuler.y + Input.GetAxis("Mouse X") * headRotatingSpeedX / 10f; float rotationY = -localEuler.x; rotationY += Input.GetAxis("Mouse Y") * headRotatingSpeedY / 10f; if (rotationY > 180) { rotationY -= 360f; } if (rotationY < -180f) { rotationY += 360f; } rotationY = Mathf.Clamp(rotationY, minimumY, maximumY); localEuler = new Vector3(-rotationY, rotationX, 0); teleporter.transform.localRotation = Quaternion.Euler(localEuler); } } else { if (teleporter != null) { teleporter.transform.localRotation = Quaternion.identity; } UnfreezeView(); } }
void OnGloveConnected() { GameRunDataHolder.SetType("InteractingSource", (int)InteractingSource.VRGlove); Teleporter teleporter = GetComponent <Teleporter>(); if (teleporter != null && model != null) { teleporter.LineDrawer.emittingPoint = model.finger; } VRInteractor interactor = GetComponent <VRInteractor>(); if (interactor != null && model != null) { interactor.acquirePoint = model.finger; transform.Find("Contactor").gameObject.SetActive(false); } }
void OnEnable() { _interactor = GetComponent <VRInteractor>(); if (_interactor == null) { Debug.LogError("VRSmooth requires the VRInteractor script", gameObject); return; } if (vrRigRoot == null) { vrRigRoot = _interactor.GetVRRigRoot; } _agent = vrRigRoot.GetComponent <NavMeshAgent>(); if (_agent == null) { _agent = vrRigRoot.gameObject.AddComponent <NavMeshAgent>(); } _agent.enabled = true; _agent.updatePosition = false; }
void Start() { _teleporter = GetComponent <ArcTeleporter>(); _smooth = GetComponent <VRSmooth>(); _interactor = GetComponent <VRInteractor>(); if (_teleporter == null) { Debug.LogError("Missing ArcTeleporter", gameObject); return; } if (_smooth == null) { Debug.LogError("Missing VRSmooth", gameObject); return; } _currentType = (LocoType)PlayerPrefs.GetInt("LocoType", 0); if (_teleporter.enabled == _smooth.enabled) { _teleporter.enabled = _currentType == LocoType.ARCTELEPORTER; _smooth.enabled = _currentType == LocoType.SMOOTH; } }
public void InteractorDirty(VRInteractor interactor, bool isLeftHand) { CmdInteractorDirty(interactor.Velocity, interactor.AngularVelocity, isLeftHand); }
/// <summary> /// Strip the SteamVR or Oculus camera rig and add the remote scripts /// for receiving input. /// </summary> public void ConvertToRemoteRig() { if (remoteRig) { return; } remoteRig = true; Component[] components = GetComponentsInChildren <Component>(true); foreach (Component comp in components) { if (comp == null || !CanDestroyType(comp) || !comp.gameObject.CanDestroy(comp.GetType())) { continue; } if (comp.GetType().IsSubclassOf(typeof(VRInput))) { VRInputRemote inputRemote = comp.gameObject.AddComponent <VRInputRemote>(); // Initial Sync VRInput originalInput = (VRInput)comp; inputRemote.VRActions = originalInput.VRActions; inputRemote._isSteamVR = originalInput.isSteamVR(); inputRemote._hmdType = originalInput.hmdType; inputRemote._leftHand = originalInput.LeftHand; if (originalInput.LeftHand) { leftHand = comp.gameObject; } else { rightHand = comp.gameObject; } inputRemote.triggerKey = originalInput.triggerKey; inputRemote.padTop = originalInput.padTop; inputRemote.padLeft = originalInput.padLeft; inputRemote.padRight = originalInput.padRight; inputRemote.padBottom = originalInput.padBottom; inputRemote.padCentre = originalInput.padCentre; inputRemote.padTouch = originalInput.padTouch; inputRemote.gripKey = originalInput.gripKey; inputRemote.menuKey = originalInput.menuKey; inputRemote.AXKey = originalInput.AXKey; inputRemote.triggerKeyOculus = originalInput.triggerKeyOculus; inputRemote.padTopOculus = originalInput.padTopOculus; inputRemote.padLeftOculus = originalInput.padLeftOculus; inputRemote.padRightOculus = originalInput.padRightOculus; inputRemote.padBottomOculus = originalInput.padBottomOculus; inputRemote.padCentreOculus = originalInput.padCentreOculus; inputRemote.padTouchOculus = originalInput.padTouchOculus; inputRemote.gripKeyOculus = originalInput.gripKeyOculus; inputRemote.menuKeyOculus = originalInput.menuKeyOculus; inputRemote.AXKeyOculus = originalInput.AXKeyOculus; } if (comp.GetType().IsSubclassOf(typeof(VRInteractor))) { VRInteractorRemote interactorRemote = comp.gameObject.AddComponent <VRInteractorRemote>(); //Initial Sync VRInteractor originalInteractor = (VRInteractor)comp; interactorRemote.useHoverLine = originalInteractor.useHoverLine; if (originalInteractor.useHoverLine) { interactorRemote.hoverLineMat = originalInteractor.hoverLineMat; } interactorRemote.hideControllersWhileHolding = originalInteractor.hideControllersWhileHolding; interactorRemote.controllerAnchor = originalInteractor.controllerAnchor; interactorRemote.controllerAnchorOffset = originalInteractor.controllerAnchorOffset; interactorRemote.ikTarget = originalInteractor.ikTarget; interactorRemote.forceGrabDirection = originalInteractor.forceGrabDirection; interactorRemote.forceGrabDistance = originalInteractor.forceGrabDistance; } Destroy(comp); } foreach (Component comp in components) { if (comp == null || !CanDestroyType(comp)) { continue; } Destroy(comp); } if (leftHand != null) { leftHand.SetActive(true); } if (rightHand != null) { rightHand.SetActive(true); } }