protected virtual void Awake() { AdditionalInitialization(); trackedObject = GetComponent <SteamVR_Behaviour_Pose>(); interactor = GetComponent <Interactor>(); inventory = Player.instance.GetComponent <Inventory>(); interactor.interactorID = VRManager.Hand2Int(handType); GetComponent <EquipPoint>().equipID = interactor.interactorID; }
bool CheckHandForWristRadialOpen(SteamVR_Input_Sources hand) { if (quickInventoryToggle.GetStateDown(hand)) { Debug.LogError("YO"); inventoryUI.OpenQuickInventoryUI(VRManager.Hand2Int(hand)); // VRUIInput.SetUIHand(hand); // TransformBehavior.AdjustTransform(inventoryUI.quickInventory.baseObject.transform, Player.instance.GetHand(hand).transform, quickInventoryEquip, 0); return(true); } return(false); }
void UpdateClimbs() { InteractionSystem.Interactor interactor = GetComponent <InteractionSystem.Interactor>(); climbables[0] = interactor.HasTag("ClimbRight"); climbables[1] = interactor.HasTag("ClimbLeft"); bool justLetGo = false; // foreach (var hand in climbableChecks.Keys) { for (int hand = 0; hand < 2; hand++) { SteamVR_Input_Sources handVR = VRManager.Int2Hand(hand); // bool isClimbable = climbableChecks[hand].isClimbable; bool isClimbable = climbables[hand]; // if we just clicked to start climbing, make this the primary climb hand if (isClimbable && climbAction.GetStateDown(handVR)) { SetHandClimb(handVR); } //if this is the current climbing hand if (isClimbing && currentClimbHand == handVR) { // if we've let go to stop climbing if (!isClimbable || climbAction.GetStateUp(handVR)) { isClimbing = false; justLetGo = true; //check if our other hand is climbable and gripping (so we make that the primary one again) SteamVR_Input_Sources otherHand = VRManager.OtherHand(handVR); if (climbables[VRManager.Hand2Int(otherHand)] && climbAction.GetState(otherHand)) { justLetGo = false; SetHandClimb(otherHand); } } } } /* * Assumes the open equip button is the side button * as well as teh teleport button */ Teleport.instance.teleportationAllowed = !isClimbing && !Player.instance.handsTogether; moveScript.useRawMovement = isClimbing; if (isClimbing) { Vector3 handLocalPosition = Player.instance.GetHand(currentClimbHand).transform.localPosition; moveScript.SetInputMoveVector(previousHandPosition - handLocalPosition); previousHandPosition = handLocalPosition; } else { if (justLetGo) { Vector3 momentum = previousHandPosition - (Player.instance.GetHand(currentClimbHand).transform.localPosition); moveScript.SetMomentum(momentum.MultiplyBy(climbExitForceMultiplier) ); } } }