private void Update() { if (openMenuAction.GetState(menuHand)) { if (!menuPressed) { menuPressed = true; menuObject.SetActive(!menuObject.activeSelf); if (menuObject.activeSelf && activeHand == laserPointerLeft && pointerActive) { activeHand.ToggleLaser(false); pointerActive = false; } } } else if (menuPressed) { menuPressed = false; } if (pointerActive && playerRB.velocity.magnitude > pointerMoveSpeedTreshold) { activeHand.ToggleLaser(false); pointerActive = false; } if (clickAction.GetState(SteamVR_Input_Sources.RightHand)) { if (activeHand == laserPointerLeft) { activeHand.ToggleLaser(false); pointerActive = false; activeHand = laserPointerRight; } if (!pointerActive) { activeHand.ToggleLaser(true); pointerActive = true; } } else if (clickAction.GetState(SteamVR_Input_Sources.LeftHand)) { if (activeHand == laserPointerRight) { activeHand.ToggleLaser(false); pointerActive = false; activeHand = laserPointerLeft; } if (!pointerActive && !menuObject.activeSelf) { activeHand.ToggleLaser(true); pointerActive = true; } } }
private void Start() { activeHand = laserPointerRight; activeHand.ToggleLaser(true); playerRB = transform.root.GetComponent <Rigidbody>(); }