private void CreateSnapPoint(VR_HandInteractSettings settings) { settings.interactPoint = new GameObject("SnapPoint").transform; settings.interactPoint.parent = transform; settings.interactPoint.localPosition = Vector3.zero; settings.interactPoint.localRotation = Quaternion.identity; }
public void InteractWithNearesObject() { //we have something grabbe we should no interact if (currentGrab != null) { return; } SetDefaultInteractAnimation(); //get the near interact object to this controller VR_Interactable interact = FindNearInteract(); if (interact == null && activeDistanceGrabbable != null && (activeDistanceGrabbable != otherController.activeDistanceGrabbable || !ThereIsNearbyControllerInteraction(activeDistanceGrabbable))) { interact = activeDistanceGrabbable as VR_Interactable; } if (interact != null && interact.enabled && interact.CanInteractUsingController(this)) { VR_HandInteractSettings settings = interact.GetHandInteractionSettings(this); ProcessInteractSettings(settings); ProcessInteraction(interact); } }
private void ProcessInteractSettings(VR_HandInteractSettings settings) { if (animator != null && settings != null && settings.animation != null) { //override the grabbing animation OverrideInteractAnimation(settings.animation); } }
protected virtual void Awake() { //if we dont use per hand settings set general settings as the settings for both hands if (!usePerHandSettings) { rightHandSettings = handSettings; leftHandSettings = handSettings; } //register this interactable VR_Manager.instance.RegisterInteract(this); //create snap points if we need they CreateAllSnapPoints(); }
public void ProcessControllerInfoInteraction(VR_ControllerInfo info) { VR_HandInteractSettings settings = info.controller.ControllerType == VR_ControllerType.Right ? rightHandSettings : leftHandSettings; Transform highlightPoint = info.controller.ControllerType == VR_ControllerType.Right ? HighlightPointRightHand : HighlightPointLeftHand; bool ignoreDistance = false; //if we are trying to do a distance grab using this controller if (useDistanceGrab && activeDistanceGrabControllerList != null && activeDistanceGrabControllerList.Count > 0 && activeDistanceGrabControllerList.Contains(info.controller)) { ignoreDistance = true; } if (settings.canInteract && highlightPoint != null) { CheckIfShouldInteractWithController(info, ignoreDistance); } }