private void OnEnable() { Debug.Log("InputManager enabled"); controls = new VRInput(); controls.Enable(); controls.Player.LeftGrip.performed += LeftGrip; controls.Player.RightGrip.performed += RightGrip; controls.Player.LeftIndex.performed += LeftIndex; controls.Player.RightIndex.performed += RightIndex; controls.Player.LeftThumbstick.performed += LeftThumbstick; controls.Player.RightThumbstick.performed += RightThumbstick; controls.Player.RightThumbstickPress.performed += RightThumbstickPress; controls.Player.LeftGrip.canceled += LeftGripCancel; controls.Player.RightGrip.canceled += RightGripCancel; controls.Player.LeftIndex.canceled += LeftIndexCancel; controls.Player.RightIndex.canceled += RightIndexCancel; controls.Player.LeftThumbstick.canceled += LeftThumbstickCancel; controls.Player.RightThumbstick.canceled += RightThumbstickCancel; controls.Player.RightThumbstickPress.canceled += RightThumbstickPressCancel; controls.Hacker.CameraMovement.performed += CameraMovement; controls.Hacker.CameraMovement.canceled += CameraMovementStop; controls.Hacker.Click.performed += Click; controls.Hacker.Point.performed += MousePosition; }
void Update() { if (VRInput.GetDown(GenericVRButton.Index, handedness)) { Shoot(); } }
protected virtual void ReadTouchpad() { var touchPoint = new Vector2(VRInput.GetAxis(nodeState, InputAxis.JoypadX), VRInput.GetAxis(nodeState, InputAxis.JoypadY)); var touchButton = VRInput.GetTouch(nodeState, InputAxis.Joypad) > .5f; if (touchButton) { var delta = touchPoint - lastTouchPoint; if (!touchIsScrolling) { if (delta.magnitude * trackpadScrollSpeed > scrollThreshold) { touchIsScrolling = true; lastTouchPoint = touchPoint; } else { //don't start updating the touch point yet } } else { ScrollDelta = new Vector2(-delta.x, delta.y) * trackpadScrollSpeed; lastTouchPoint = touchPoint; } } else { ScrollDelta = new Vector2(); lastTouchPoint = touchPoint; touchIsScrolling = false; } }
static void Prefix(PUI_SkipText __instance, Action onSkip) { if (VRInput.GetActionDown(InputAction.Fire)) { onSkip?.Invoke(); } }
public void InputDirty(VRInput input) { CmdInputDirty(input.TriggerPressed, input.TriggerPressure, input.PadTopPressed, input.PadLeftPressed, input.PadRightPressed, input.PadBottomPressed, input.PadCentrePressed, input.PadTouched, input.PadPressed, input.PadPosition, input.GripPressed, input.MenuPressed, input.AXPressed, input.LeftHand); }
protected virtual void ReadInput() { DepressedButtons = 0; ScrollDelta = Vector2.zero; if (!nodeState.tracked) { return; } var leftClick = VRInput.GetAxis(nodeState, InputAxis.MainTrigger); if (leftClick > .9f) { DepressedButtons |= MouseButton.Left; } var rightClick = VRInput.GetAxis(nodeState, InputAxis.Grip); if (rightClick > .5f) { DepressedButtons |= MouseButton.Right; } switch (VRInput.GetJoypadType(nodeState)) { case JoyPadType.Joystick: ReadJoystick(); break; case JoyPadType.TouchPad: ReadTouchpad(); break; } }
private void Update() { if (VRInput.GetControlDown(hand.HandType, Controls.Menu)) { Move(); } }
public virtual void OnEnable() { teleporter = (ArcTeleporter)target; if (teleporter.raycastLayer != null) { raycastLayersSize = teleporter.raycastLayer.Count; } else { raycastLayersSize = 0; } if (teleporter.tags != null) { tagsSize = teleporter.tags.Count; } else { tagsSize = 0; } input = teleporter.GetComponent <VRInput>(); if (input == null) { input = teleporter.gameObject.AddComponent <VRInput>(); SetDefaultActions(); EditorUtility.SetDirty(teleporter); EditorSceneManager.MarkSceneDirty(SceneManager.GetActiveScene()); } }
// Use this for initialization void Start() { hand = GetComponent <VRInput>(); rigidbodyHand = GetComponent <Rigidbody>(); skateController = FindObjectOfType <SkateController>(); velocimeter = FindObjectOfType <Velocimeter>(); }
private void AxesStateLabel(VRButton button) { var axes = VRInput.GetAxes(button); UnityGUI.Label(button.ToString() + " X: " + axes[0].ToString("0.000")); UnityGUI.Label(button.ToString() + " Y: " + axes[1].ToString("0.000")); }
public void interact() { if (isLocked) { VRInput player = GameObject.FindGameObjectWithTag("Player").GetComponent <VRInput>(); if (player.hasConsole) { isLocked = false; } } // play opening animation if (!isLocked) { if (doorOpen == false) { doorOpen = true; anim.SetBool("DoorOpen", true); } // play closing animation else if (doorOpen == true) { doorOpen = false; anim.SetBool("DoorOpen", false); } } }
void Awake() { if (instance == null) { instance = this; } vrInput = GetComponentInChildren <VRInput>(); reticleUi.gameObject.SetActive(!useGoogleCardboard); if (gvrReticle != null) { gvrReticle.SetActive(useGoogleCardboard); } if (GvrViewerMain != null) { GvrViewerMain.SetActive(useGoogleCardboard); } if (useGoogleCardboard == true) { gameObject.AddComponent <GvrPointerPhysicsRaycaster>(); eventSystem.AddComponent <GvrPointerManager>(); eventSystem.AddComponent <GvrPointerInputModule>(); Debug.Log(GvrPointerManager.Pointer); } }
void Awake() { ReticleCamera = Camera.main.transform; float distance = (transform.position - ReticleCamera.position).magnitude; if (GVRControllerPointer != null) { distance = (transform.position - GVRControllerPointer.position).magnitude; } //if we're the reticle that does not have the controller pointer defined if (GlobalVars.Instance.IsDaydream && GVRControllerPointer == null) { this.gameObject.SetActive(false); } CurGazeSelectionTime = GazeSelectionTime; _originalScale = transform.localScale / distance; _vrInput = gameObject.GetComponent <VRInput>(); _reticalCenterImage = ReticleCenter.GetComponent <Image>(); _reticalOuterImage = ReticleOuter.GetComponent <Image>(); _reticalLoaderImage = ReticleLoader.GetComponent <Image>(); _reticalOuterImage.CrossFadeAlpha(0.0f, 0.0f, false); _reticalLoaderImage.CrossFadeAlpha(0.0f, 0.0f, false); }
private void UpdateNew(float deltaTime) { Vector2 touch = VRInput.PadTouchValue(handType); float x = touch.x; float y = touch.y; if (VRInput.GetControlDown(handType, ControlType.DPadCenter)) { OnClickMiddle?.Invoke(x, y); return; } if (VRInput.GetControlDown(handType, ControlType.DPadNorth)) { OnClickUp?.Invoke(x, y); } else if (VRInput.GetControlDown(handType, ControlType.DPadSouth)) { OnClickDown?.Invoke(x, y); } if (VRInput.GetControlDown(handType, ControlType.DPadWest)) { OnClickLeft?.Invoke(x, y); } else if (VRInput.GetControlDown(handType, ControlType.DPadEast)) { OnClickRight?.Invoke(x, y); } }
void Update() { if (VRInput.getRightTriggerDown() && rightHand != null) { OnGrab(rightHand); } if (VRInput.getLeftTriggerDown() && leftHand != null) { OnGrab(leftHand); } if (VRInput.getRightTrigger() && rightHand != null) { WhileGrabbed(rightHand); } if (VRInput.getLeftTrigger() && leftHand != null) { WhileGrabbed(leftHand); } if (VRInput.getRightTriggerRelease() && rightHand != null) { OnRelease(rightHand); } if (VRInput.getLeftTriggerRelease() && leftHand != null) { OnRelease(leftHand); } }
protected override void OnEnableObject() { base.OnEnableObject(); _pVRInput = CManagerVR.instance.p_pVRInput; _pVRInput.OnDown += HandleDown; }
void Update() { if (VRInput.GetButtonDown(button, hand)) { SetEnabled(!enabled); } }
/// <summary> /// 檢查圓盤四邊的狀態 /// 需要找個物件掛上 SteamVR_ActivateActionSetOnLoad.cs 激活 platformer動作集 /// </summary> private void Check_PadPos() { //上 if (VRInput.GetPressDown(inputSource, EM_ControllerButton.PadUp)) { Debug.LogWarning("按下圓盤-上"); } if (VRInput.GetPress(inputSource, EM_ControllerButton.PadUp)) { Debug.LogWarning("按住圓盤-上"); } if (VRInput.GetPressUp(inputSource, EM_ControllerButton.PadUp)) { Debug.LogWarning("放開圓盤-上"); } //下 if (VRInput.GetPressDown(inputSource, EM_ControllerButton.PadDown)) { Debug.LogWarning("按下圓盤-下"); } if (VRInput.GetPress(inputSource, EM_ControllerButton.PadDown)) { Debug.LogWarning("按住圓盤-下"); } if (VRInput.GetPressUp(inputSource, EM_ControllerButton.PadDown)) { Debug.LogWarning("放開圓盤-下"); } //左 if (VRInput.GetPressDown(inputSource, EM_ControllerButton.PadLeft)) { Debug.LogWarning("按下圓盤-左"); } if (VRInput.GetPress(inputSource, EM_ControllerButton.PadLeft)) { Debug.LogWarning("按住圓盤-左"); } if (VRInput.GetPressUp(inputSource, EM_ControllerButton.PadLeft)) { Debug.LogWarning("放開圓盤-左"); } //右 if (VRInput.GetPressDown(inputSource, EM_ControllerButton.PadRight)) { Debug.LogWarning("按下圓盤-右"); } if (VRInput.GetPress(inputSource, EM_ControllerButton.PadRight)) { Debug.LogWarning("按住圓盤-右"); } if (VRInput.GetPressUp(inputSource, EM_ControllerButton.PadRight)) { Debug.LogWarning("放開圓盤-右"); } }
private void Awake() { // vrRaycaster = ReferenceManagerIndependent.Instance.VRRaycaster; fps = (FirstPersonController)FindObjectOfType(typeof(FirstPersonController)); m_VrInput = ReferenceManagerIndependent.Instance.VRInput; platformManager = ReferenceManagerIndependent.Instance.PlatformManager; player = ReferenceManagerIndependent.Instance.Player; }
void Awake() { Activation = true; m_Player = m_Camera.GetComponent <PlayerToBlocks>(); m_VRInput = m_Camera.GetComponentInChildren <VRInput>(); Position = m_VRInput.transform.position; m_Selected = false; }
private void Update() { if (VRInput.GetControlDown(type, Controls.DevEnv)) { show = !show; RecursiveChildSearch(transform); } }
public static void UpdateObjectives(string mainObj, string subObj) { if (objectiveDisplay != null) { objectiveDisplay.text = "WARDEN OBJECTIVE: \n \n " + mainObj + "\n \n " + subObj; VRInput.TriggerHapticPulse(0.01f, 1 / .025f, 0.2f, Controllers.GetDeviceFromType(Controllers.offHandControllerType)); } }
public void CloseUI(VRInput controller) { if (controller == currentController) { currentController = null; gameObject.SetActive(false); } }
private void SetVelocity() { if (Connector as HandConnector is var handConnector && handConnector != null) { rb.velocity = VRInput.Skeleton(handConnector.Hand.HandType).velocity; rb.angularVelocity = VRInput.Skeleton(handConnector.Hand.HandType).angularVelocity; } }
public void Gaze(VRInput context) { input = context; if (context.Target != this) { context.Target = this; } }
public void InitInput(VRInput pVRInput) { _VrInput = pVRInput; _VrInput.OnClick += HandleClick; _VrInput.OnDoubleClick += HandleDoubleClick; _VrInput.OnUp += HandleUp; _VrInput.OnDown += HandleDown; }
protected override void OnAwake() { base.OnAwake(); if (_pVRInput == null) { _pVRInput = FindObjectOfType <VRInput>(); } }
// Start is called before the first frame update. // Starting coroutine and declerating variables. void Start() { changed = 0; robot_pose_sub = GameObject.Find("RosBridge").GetComponent <PoseStampedSubscriber>(); input = GameObject.Find("Input").GetComponent <VRInput>(); info = this.GetComponent <RobotInformation>(); StartCoroutine("timer"); Debug.Log("Roboter Control: Starting to update position of robot"); }
void Start() { moveForward = true; // Add eye-depth as a camera offset from the player controller var p = CameraRig.transform.localPosition; p.z = OVRManager.profile.eyeDepth; CameraRig.transform.localPosition = p; myInput = transform.GetComponent <VRInput>(); }
void Update() { foreach (var vrInputEvent in _events) { if (VRInput.GetButtonDown(vrInputEvent.trigger) || VRInput.GetAxisAsButtonDown(vrInputEvent.trigger)) { vrInputEvent.unityEvent.Invoke(vrInputEvent.trigger); } } }
public void Gaze(VRInput context) { input = context; if(context.Target != this){ context.Target = this; } }
void Awake() { instance = this; layerMask = 1 << LayerMask.NameToLayer(UILayer) | 1 << LayerMask.NameToLayer(GeometryLayer); //UpdateReticleColor(); }
private void HandleSwipe (VRInput.SwipeDirection swipe) { // Store the swipe this frame. m_CurrentSwipe = swipe; }