private void Update() { float strafe = Input.GetAxis("Horizontal") * Time.deltaTime * walkingSpeed; float forwardBackward = Input.GetAxis("Vertical") * Time.deltaTime * walkingSpeed; float mouseY = Input.GetAxis("Mouse Y") * -sensitivity; float mouseX = Input.GetAxis("Mouse X") * sensitivity; transform.Translate(strafe, 0.0f, forwardBackward); transform.Rotate(0.0f, mouseX, 0.0f); transform.Find("[Camera]").transform.Rotate(mouseY, 0.0f, 0.0f); if (Input.GetKeyDown(KeyCode.Mouse0)) { orbGun.Fire(); } if (Input.GetKeyDown(KeyCode.Mouse1)) { ChangeOrbType(); } }
private void Update() { if (rightController != null) { if (rightController.GetHairTriggerDown()) { rightOrbGun.Fire(); } if (rightController.GetPressDown(SteamVR_Controller.ButtonMask.Touchpad)) { ChangeOrbType(rightOrbGun, ViveController.RIGHT, rightController.GetAxis(Valve.VR.EVRButtonId.k_EButton_SteamVR_Touchpad)); } } else { StopCoroutine(SetupRightController()); StartCoroutine(SetupRightController()); } if (leftController != null) { if (leftController.GetHairTriggerDown()) { leftOrbGun.Fire(); } if (leftController.GetPressDown(SteamVR_Controller.ButtonMask.Touchpad)) { ChangeOrbType(leftOrbGun, ViveController.LEFT, leftController.GetAxis(Valve.VR.EVRButtonId.k_EButton_SteamVR_Touchpad)); } } else { StopCoroutine(SetupLeftController()); StartCoroutine(SetupLeftController()); } }