private void OnEnable() { CreateCollider(); lastGoodPositionSet = false; headset = VRTK_DeviceFinder.HeadsetTransform(); StartCoroutine(WaitForHeadsetCollision(true)); InitControllerListeners(VRTK_DeviceFinder.GetControllerLeftHand(), true); InitControllerListeners(VRTK_DeviceFinder.GetControllerRightHand(), true); }
protected virtual void ManageDestinationMarkers(bool state) { ManageDestinationMarkerListeners(VRTK_DeviceFinder.GetControllerLeftHand(), state); ManageDestinationMarkerListeners(VRTK_DeviceFinder.GetControllerRightHand(), state); foreach (var destinationMarker in VRTK_ObjectCache.registeredDestinationMarkers) { ManageDestinationMarkerListeners(destinationMarker.gameObject, state); } }
protected virtual void ManageDestinationMarkers(bool state) { ManageDestinationMarkerListeners(VRTK_DeviceFinder.GetControllerLeftHand(), state); ManageDestinationMarkerListeners(VRTK_DeviceFinder.GetControllerRightHand(), state); for (int i = 0; i < VRTK_ObjectCache.registeredDestinationMarkers.Count; i++) { VRTK_DestinationMarker destinationMarker = VRTK_ObjectCache.registeredDestinationMarkers[i]; ManageDestinationMarkerListeners(destinationMarker.gameObject, state); } }
private void Awake() { touchpadAxisChanged = new ControllerInteractionEventHandler(DoTouchpadAxisChanged); touchpadUntouched = new ControllerInteractionEventHandler(DoTouchpadTouchEnd); playArea = VRTK_DeviceFinder.PlayAreaTransform(); controllerLeftHand = VRTK_DeviceFinder.GetControllerLeftHand(); controllerRightHand = VRTK_DeviceFinder.GetControllerRightHand(); if (!playArea) { Debug.LogError("No play area could be found. Have you selected a valid Boundaries SDK in the SDK Manager? If you are unsure, then click the GameObject with the `VRTK_SDKManager` script attached to it in Edit Mode and select a Boundaries SDK from the dropdown."); } }
// Token: 0x06001BAD RID: 7085 RVA: 0x00090CCD File Offset: 0x0008EECD public static SDK_BaseController.ControllerHand GetModelAliasControllerHand(GameObject givenObject) { if (VRTK_DeviceFinder.GetModelAliasController(VRTK_DeviceFinder.GetControllerLeftHand(false)) == givenObject) { return(SDK_BaseController.ControllerHand.Left); } if (VRTK_DeviceFinder.GetModelAliasController(VRTK_DeviceFinder.GetControllerRightHand(false)) == givenObject) { return(SDK_BaseController.ControllerHand.Right); } return(SDK_BaseController.ControllerHand.None); }
protected virtual void OnEnable() { playArea = VRTK_DeviceFinder.PlayAreaTransform(); headset = VRTK_DeviceFinder.HeadsetTransform(); controllingTransform = (controllingTransform != null ? controllingTransform : playArea); offsetTransform = (offsetTransform != null ? offsetTransform : headset); leftControllerEvents = GetControllerEvents(VRTK_DeviceFinder.GetControllerLeftHand()); rightControllerEvents = GetControllerEvents(VRTK_DeviceFinder.GetControllerRightHand()); movementActivated = false; rotationActivated = false; scaleActivated = false; ManageActivationListeners(true); }
protected virtual void Awake() { touchpadAxisChanged = new ControllerInteractionEventHandler(DoTouchpadAxisChanged); touchpadUntouched = new ControllerInteractionEventHandler(DoTouchpadTouchEnd); playArea = VRTK_DeviceFinder.PlayAreaTransform(); controllerLeftHand = VRTK_DeviceFinder.GetControllerLeftHand(); controllerRightHand = VRTK_DeviceFinder.GetControllerRightHand(); if (!playArea) { VRTK_Logger.Error(VRTK_Logger.GetCommonMessage(VRTK_Logger.CommonMessageKeys.SDK_OBJECT_NOT_FOUND, "PlayArea", "Boundaries SDK")); } VRTK_PlayerObject.SetPlayerObject(gameObject, VRTK_PlayerObject.ObjectTypes.CameraRig); }
// Token: 0x060017B3 RID: 6067 RVA: 0x0007EB70 File Offset: 0x0007CD70 protected virtual void InitDestinationMarkerListeners(bool state) { GameObject controllerLeftHand = VRTK_DeviceFinder.GetControllerLeftHand(false); GameObject controllerRightHand = VRTK_DeviceFinder.GetControllerRightHand(false); this.InitDestinationSetListener(controllerLeftHand, state); this.InitDestinationSetListener(controllerRightHand, state); foreach (VRTK_DestinationMarker vrtk_DestinationMarker in VRTK_ObjectCache.registeredDestinationMarkers) { if (vrtk_DestinationMarker.gameObject != controllerLeftHand && vrtk_DestinationMarker.gameObject != controllerRightHand) { this.InitDestinationSetListener(vrtk_DestinationMarker.gameObject, state); } } }
protected virtual void InitDestinationMarkerListeners(bool state) { var leftHand = VRTK_DeviceFinder.GetControllerLeftHand(); var rightHand = VRTK_DeviceFinder.GetControllerRightHand(); InitDestinationSetListener(leftHand, state); InitDestinationSetListener(rightHand, state); foreach (var destinationMarker in VRTK_ObjectCache.registeredDestinationMarkers) { if (destinationMarker.gameObject != leftHand && destinationMarker.gameObject != rightHand) { InitDestinationSetListener(destinationMarker.gameObject, state); } } }
protected virtual void InitDestinationMarkerListeners(bool state) { GameObject leftHand = VRTK_DeviceFinder.GetControllerLeftHand(); GameObject rightHand = VRTK_DeviceFinder.GetControllerRightHand(); InitDestinationSetListener(leftHand, state); InitDestinationSetListener(rightHand, state); for (int i = 0; i < VRTK_ObjectCache.registeredDestinationMarkers.Count; i++) { VRTK_DestinationMarker destinationMarker = VRTK_ObjectCache.registeredDestinationMarkers[i]; if (destinationMarker.gameObject != leftHand && destinationMarker.gameObject != rightHand) { InitDestinationSetListener(destinationMarker.gameObject, state); } } }
// Token: 0x06001856 RID: 6230 RVA: 0x000812AC File Offset: 0x0007F4AC protected virtual void OnEnable() { this.touchpadAxisChanged = new ControllerInteractionEventHandler(this.DoTouchpadAxisChanged); this.touchpadUntouched = new ControllerInteractionEventHandler(this.DoTouchpadTouchEnd); this.controllerLeftHand = VRTK_DeviceFinder.GetControllerLeftHand(false); this.controllerRightHand = VRTK_DeviceFinder.GetControllerRightHand(false); this.playArea = VRTK_DeviceFinder.PlayAreaTransform(); if (!this.playArea) { VRTK_Logger.Error(VRTK_Logger.GetCommonMessage(VRTK_Logger.CommonMessageKeys.SDK_OBJECT_NOT_FOUND, new object[] { "PlayArea", "Boundaries SDK" })); } this.headset = VRTK_DeviceFinder.HeadsetTransform(); if (!this.headset) { VRTK_Logger.Error(VRTK_Logger.GetCommonMessage(VRTK_Logger.CommonMessageKeys.SDK_OBJECT_NOT_FOUND, new object[] { "HeadsetTransform", "Headset SDK" })); } VRTK_PlayerObject.SetPlayerObject(base.gameObject, VRTK_PlayerObject.ObjectTypes.CameraRig); this.SetControllerListeners(this.controllerLeftHand, this.leftController, ref this.leftSubscribed, false); this.SetControllerListeners(this.controllerRightHand, this.rightController, ref this.rightSubscribed, false); this.bodyPhysics = base.GetComponent <VRTK_BodyPhysics>(); this.movementSpeed = 0f; this.strafeSpeed = 0f; this.blinkFadeInTime = 0f; this.lastWarp = 0f; this.lastFlip = 0f; this.lastSnapRotate = 0f; this.multiplyMovement = false; this.bodyCollider = this.playArea.GetComponentInChildren <CapsuleCollider>(); if (!this.bodyCollider) { VRTK_Logger.Error(VRTK_Logger.GetCommonMessage(VRTK_Logger.CommonMessageKeys.REQUIRED_COMPONENT_MISSING_FROM_GAMEOBJECT, new object[] { "VRTK_TouchpadMovement", "CapsuleCollider", "the PlayArea" })); } }
// Token: 0x06001BA2 RID: 7074 RVA: 0x00090B9B File Offset: 0x0008ED9B public static Transform DeviceTransform(VRTK_DeviceFinder.Devices device) { switch (device) { case VRTK_DeviceFinder.Devices.Headset: return(VRTK_DeviceFinder.HeadsetTransform()); case VRTK_DeviceFinder.Devices.LeftController: return(VRTK_DeviceFinder.GetControllerLeftHand(false).transform); case VRTK_DeviceFinder.Devices.RightController: return(VRTK_DeviceFinder.GetControllerRightHand(false).transform); default: return(null); } }
protected virtual Transform GetDirectionDevice() { switch (deviceForDirection) { case DirectionDevices.ControlledObject: return(controlledGameObject.transform); case DirectionDevices.Headset: return(VRTK_DeviceFinder.HeadsetTransform()); case DirectionDevices.LeftController: return(VRTK_DeviceFinder.GetControllerLeftHand(true).transform); case DirectionDevices.RightController: return(VRTK_DeviceFinder.GetControllerRightHand(true).transform); } return(null); }
protected virtual void OnEnable() { playArea = VRTK_DeviceFinder.PlayAreaTransform(); headset = VRTK_DeviceFinder.HeadsetTransform(); controllingTransform = (controllingTransform != null ? controllingTransform : playArea); offsetTransform = (offsetTransform != null ? offsetTransform : headset); leftControllerEvents = GetControllerEvents(VRTK_DeviceFinder.GetControllerLeftHand()); rightControllerEvents = GetControllerEvents(VRTK_DeviceFinder.GetControllerRightHand()); movementActivated = false; rotationActivated = false; scaleActivated = false; ManageActivationListeners(true); SetControllerReferences(); GameObject[] heavyObs = GameObject.FindGameObjectsWithTag("HeavyPickup"); heavies = new VRTK_InteractableObject[heavyObs.Length]; for (int i = 0; i < heavyObs.Length; i++) { heavies [i] = heavyObs [i].GetComponent(typeof(VRTK_InteractableObject)) as VRTK_InteractableObject; } }
protected virtual void OnEnable() { touchpadAxisChanged = new ControllerInteractionEventHandler(DoTouchpadAxisChanged); touchpadUntouched = new ControllerInteractionEventHandler(DoTouchpadTouchEnd); playArea = VRTK_DeviceFinder.PlayAreaTransform(); controllerLeftHand = VRTK_DeviceFinder.GetControllerLeftHand(); controllerRightHand = VRTK_DeviceFinder.GetControllerRightHand(); if (!playArea) { VRTK_Logger.Error(VRTK_Logger.GetCommonMessage(VRTK_Logger.CommonMessageKeys.SDK_OBJECT_NOT_FOUND, "PlayArea", "Boundaries SDK")); } VRTK_PlayerObject.SetPlayerObject(gameObject, VRTK_PlayerObject.ObjectTypes.CameraRig); SetControllerListeners(controllerLeftHand, leftController, ref leftSubscribed); SetControllerListeners(controllerRightHand, rightController, ref rightSubscribed); bodyPhysics = GetComponent <VRTK_BodyPhysics>(); movementSpeed = 0f; strafeSpeed = 0f; multiplySpeed = false; }
protected virtual void OnEnable() { touchpadAxisChanged = new ControllerInteractionEventHandler(DoTouchpadAxisChanged); touchpadUntouched = new ControllerInteractionEventHandler(DoTouchpadTouchEnd); controllerLeftHand = VRTK_DeviceFinder.GetControllerLeftHand(); controllerRightHand = VRTK_DeviceFinder.GetControllerRightHand(); playArea = VRTK_DeviceFinder.PlayAreaTransform(); if (!playArea) { VRTK_Logger.Error(VRTK_Logger.GetCommonMessage(VRTK_Logger.CommonMessageKeys.SDK_OBJECT_NOT_FOUND, "PlayArea", "Boundaries SDK")); } headset = VRTK_DeviceFinder.HeadsetTransform(); if (!headset) { VRTK_Logger.Error(VRTK_Logger.GetCommonMessage(VRTK_Logger.CommonMessageKeys.SDK_OBJECT_NOT_FOUND, "HeadsetTransform", "Headset SDK")); } VRTK_PlayerObject.SetPlayerObject(gameObject, VRTK_PlayerObject.ObjectTypes.CameraRig); SetControllerListeners(controllerLeftHand, leftController, ref leftSubscribed); SetControllerListeners(controllerRightHand, rightController, ref rightSubscribed); bodyPhysics = GetComponent <VRTK_BodyPhysics>(); movementSpeed = 0f; strafeSpeed = 0f; blinkFadeInTime = 0f; lastWarp = 0f; lastFlip = 0f; lastSnapRotate = 0f; multiplyMovement = false; bodyCollider = playArea.GetComponentInChildren <CapsuleCollider>(); if (!bodyCollider) { VRTK_Logger.Error(VRTK_Logger.GetCommonMessage(VRTK_Logger.CommonMessageKeys.REQUIRED_COMPONENT_MISSING_FROM_GAMEOBJECT, "VRTK_TouchpadMovement", "CapsuleCollider", "the PlayArea")); } }
protected virtual void OnEnable() { trackedObjects = new List <Transform>(); movementList = new Dictionary <Transform, List <float> >(); previousYPositions = new Dictionary <Transform, float>(); initalGaze = Vector3.zero; direction = Vector3.zero; previousDirection = Vector3.zero; averagePeriod = 60; currentSpeed = 0f; active = false; previousEngageButton = engageButton; bodyPhysics = (bodyPhysics != null ? bodyPhysics : GetComponentInChildren <VRTK_BodyPhysics>()); controllerLeftHand = VRTK_DeviceFinder.GetControllerLeftHand(); controllerRightHand = VRTK_DeviceFinder.GetControllerRightHand(); SetControllerListeners(controllerLeftHand, leftController, ref leftSubscribed); SetControllerListeners(controllerRightHand, rightController, ref rightSubscribed); headset = VRTK_DeviceFinder.HeadsetTransform(); SetControlOptions(controlOptions); playArea = VRTK_DeviceFinder.PlayAreaTransform(); // Initialize the lists. for (int i = 0; i < trackedObjects.Count; i++) { Transform trackedObj = trackedObjects[i]; movementList.Add(trackedObj, new List <float>()); previousYPositions.Add(trackedObj, trackedObj.transform.localPosition.y); } if (playArea == null) { VRTK_Logger.Error(VRTK_Logger.GetCommonMessage(VRTK_Logger.CommonMessageKeys.SDK_OBJECT_NOT_FOUND, "PlayArea", "Boundaries SDK")); } }
// Token: 0x060012CB RID: 4811 RVA: 0x00069C64 File Offset: 0x00067E64 private void TryPickup(bool rightHand) { RaycastHit raycastHit; if (Physics.Raycast(Camera.main.ViewportPointToRay(new Vector3(0.5f, 0.5f, 0f)), out raycastHit) && raycastHit.collider.gameObject.GetComponent <VRTK_InteractableObject>()) { GameObject gameObject; if (rightHand) { gameObject = VRTK_DeviceFinder.GetControllerRightHand(false); } else { gameObject = VRTK_DeviceFinder.GetControllerLeftHand(false); } VRTK_InteractGrab component = gameObject.GetComponent <VRTK_InteractGrab>(); if (component.GetGrabbedObject() == null) { gameObject.GetComponent <VRTK_InteractTouch>().ForceTouch(raycastHit.collider.gameObject); component.AttemptGrab(); } } }
// Token: 0x0600186C RID: 6252 RVA: 0x00081F84 File Offset: 0x00080184 protected virtual void OnEnable() { this.touchpadAxisChanged = new ControllerInteractionEventHandler(this.DoTouchpadAxisChanged); this.touchpadUntouched = new ControllerInteractionEventHandler(this.DoTouchpadTouchEnd); this.playArea = VRTK_DeviceFinder.PlayAreaTransform(); this.controllerLeftHand = VRTK_DeviceFinder.GetControllerLeftHand(false); this.controllerRightHand = VRTK_DeviceFinder.GetControllerRightHand(false); if (!this.playArea) { VRTK_Logger.Error(VRTK_Logger.GetCommonMessage(VRTK_Logger.CommonMessageKeys.SDK_OBJECT_NOT_FOUND, new object[] { "PlayArea", "Boundaries SDK" })); } VRTK_PlayerObject.SetPlayerObject(base.gameObject, VRTK_PlayerObject.ObjectTypes.CameraRig); this.SetControllerListeners(this.controllerLeftHand, this.leftController, ref this.leftSubscribed, false); this.SetControllerListeners(this.controllerRightHand, this.rightController, ref this.rightSubscribed, false); this.bodyPhysics = base.GetComponent <VRTK_BodyPhysics>(); this.movementSpeed = 0f; this.strafeSpeed = 0f; this.multiplySpeed = false; }
protected virtual void OnEnable() { trackedObjects = new List <Transform>(); movementList = new Dictionary <Transform, List <float> >(); previousYPositions = new Dictionary <Transform, float>(); initalGaze = Vector3.zero; direction = Vector3.zero; previousDirection = Vector3.zero; averagePeriod = 60; currentSpeed = 0f; active = false; previousEngageButton = engageButton; bodyPhysics = GetComponent <VRTK_BodyPhysics>(); controllerLeftHand = VRTK_DeviceFinder.GetControllerLeftHand(); controllerRightHand = VRTK_DeviceFinder.GetControllerRightHand(); SetControllerListeners(controllerLeftHand, leftController, ref leftSubscribed); SetControllerListeners(controllerRightHand, rightController, ref rightSubscribed); headset = VRTK_DeviceFinder.HeadsetTransform(); SetControlOptions(controlOptions); playArea = VRTK_DeviceFinder.PlayAreaTransform(); // Initialize the lists. foreach (Transform trackedObj in trackedObjects) { movementList.Add(trackedObj, new List <float>()); previousYPositions.Add(trackedObj, trackedObj.transform.localPosition.y); } if (!playArea) { Debug.LogError("No play area could be found. Have you selected a valid Boundaries SDK in the SDK Manager? If you are unsure, then click the GameObject with the `VRTK_SDKManager` script attached to it in Edit Mode and select a Boundaries SDK from the dropdown."); } }
protected virtual VRTK_TouchpadControl GetOtherControl() { GameObject foundController = (VRTK_DeviceFinder.IsControllerLeftHand(gameObject) ? VRTK_DeviceFinder.GetControllerRightHand(false) : VRTK_DeviceFinder.GetControllerLeftHand(false)); if (foundController) { return(foundController.GetComponent <VRTK_TouchpadControl>()); } return(null); }
private void Update() { if (Input.GetKeyDown(toggleControlHints)) { showControlHints = !showControlHints; hintCanvas.SetActive(showControlHints); } if (mouseMovementInput == MouseInputMode.RequiresButtonPress) { if (lockMouseToView) { Cursor.lockState = Input.GetKey(mouseMovementKey) ? CursorLockMode.Locked : CursorLockMode.None; } else if (Input.GetKeyDown(mouseMovementKey)) { oldPos = Input.mousePosition; } } if (Input.GetKeyDown(handsOnOff)) { if (isHand) { SetMove(); } else { SetHand(); } } if (Input.GetKeyDown(changeHands)) { if (currentHand.name == "LeftHand") { currentHand = rightHand; rightController.Selected = true; leftController.Selected = false; } else { currentHand = leftHand; rightController.Selected = false; leftController.Selected = true; } } //Crouch neck.localPosition = Vector3.up * (Input.GetKey(crouchKey) ? playerCrouchHeight : baseHeight); if (isHand) { UpdateHands(); } else { // Hand displacement rightHand.transform.localPosition = leftHand.transform.localPosition += Vector3.forward * Input.mouseScrollDelta.y / 100; // Hand rotation GameObject hand = rightHand ? VRTK_DeviceFinder.GetControllerRightHand() : VRTK_DeviceFinder.GetControllerLeftHand(); GameObject grabbed = hand.GetComponent <VRTK_InteractGrab>().GetGrabbedObject(); if (Input.GetKey(KeyCode.R) && grabbed) { Vector3 mouseDelta = GetMouseDelta(); leftHand.Rotate(neck.forward, -mouseDelta.x, Space.World); leftHand.Rotate(neck.right, mouseDelta.y, Space.World); rightHand.rotation = leftHand.rotation; } else { UpdateRotation(); } if (Input.GetKeyDown(distancePickupRight) && Input.GetKey(distancePickupModifier)) { TryPickup(true); } else if (Input.GetKeyDown(distancePickupLeft) && Input.GetKey(distancePickupModifier)) { TryPickup(false); } if (Input.GetKey(sprint)) { sprintMultiplier = playerSprintMultiplier; } else { sprintMultiplier = 1; } if (Input.GetKeyDown(distancePickupModifier)) { crossHairPanel.SetActive(true); } else if (Input.GetKeyUp(distancePickupModifier)) { crossHairPanel.SetActive(false); } } UpdatePosition(); if (showControlHints) { UpdateHints(); } }
protected virtual void OnEnable() { headset = VRTK_DeviceFinder.HeadsetTransform(); leftController = VRTK_DeviceFinder.GetControllerLeftHand(); rightController = VRTK_DeviceFinder.GetControllerRightHand(); }
protected override VRTK_ObjectControl GetOtherControl() { GameObject foundController = (VRTK_DeviceFinder.IsControllerLeftHand(gameObject) ? VRTK_DeviceFinder.GetControllerRightHand(false) : VRTK_DeviceFinder.GetControllerLeftHand(false)); if (foundController) { return(foundController.GetComponentInChildren <VRTK_ButtonControl>()); } return(null); }
protected void InitControllerListeners(bool state) { InitControllerListener(state, VRTK_DeviceFinder.GetControllerLeftHand(), ref leftControllerEvents, ref leftControllerGrab, LeftButtonPressed, LeftButtonReleased); InitControllerListener(state, VRTK_DeviceFinder.GetControllerRightHand(), ref rightControllerEvents, ref rightControllerGrab, RightButtonPressed, RightButtonReleased); }
private void DisableBodyPhysics() { DestroyCollider(); InitControllerListeners(VRTK_DeviceFinder.GetControllerLeftHand(), false); InitControllerListeners(VRTK_DeviceFinder.GetControllerRightHand(), false); }
private void InitListeners(bool state) { InitControllerListeners(VRTK_DeviceFinder.GetControllerLeftHand(), state); InitControllerListeners(VRTK_DeviceFinder.GetControllerRightHand(), state); }
protected override VRTK_ObjectControl GetOtherControl() { // XXX: Jesse Magic - using controller.gameobject instead of gameobject // Without this, it pulled LeftController every time GameObject foundController = (VRTK_DeviceFinder.IsControllerLeftHand(controller.gameObject) ? VRTK_DeviceFinder.GetControllerRightHand(false) : VRTK_DeviceFinder.GetControllerLeftHand(false)); if (foundController != null) { return(foundController.GetComponentInChildren <VRTK_TouchpadControl>()); } return(null); }
// Token: 0x06001845 RID: 6213 RVA: 0x00080FF4 File Offset: 0x0007F1F4 protected override VRTK_ObjectControl GetOtherControl() { GameObject gameObject = VRTK_DeviceFinder.IsControllerLeftHand(base.gameObject) ? VRTK_DeviceFinder.GetControllerRightHand(false) : VRTK_DeviceFinder.GetControllerLeftHand(false); if (gameObject) { return(gameObject.GetComponent <VRTK_TouchpadControl>()); } return(null); }
// Token: 0x06001820 RID: 6176 RVA: 0x0008066F File Offset: 0x0007E86F protected virtual void InitListeners(bool state) { this.InitControllerListeners(VRTK_DeviceFinder.GetControllerLeftHand(false), state); this.InitControllerListeners(VRTK_DeviceFinder.GetControllerRightHand(false), state); this.InitTeleportListener(state); }