void Update() { LockOnTargetWithRayCast(); if (lockOnStatus && !rocketLaunched) { // start timing the gazetime and show it on the speedslider if (lockOnTimer > MAX_GAZE_TIME) { lockOnTimer = 0f; } else { lockOnTimer += Time.deltaTime; } gameCanvas.ShowSpeed(lockOnTimer / MAX_GAZE_TIME); } if (Google.XR.Cardboard.Api.IsTriggerPressed || Input.GetKey(KeyCode.Space)) { // Spacebar down or Google trigger pressed, start launching! CalculateRocketSpeed(lockOnTimer); rocketLaunched = true; Debug.Log("Rocket launched!"); } // Move our position a step closer to the target every frame if (rocketLaunched && target != null) { Launch(target.transform); // Shows the speed that was given during launch gameCanvas.ShowLockedOnTargetText(); gameCanvas.ShowSpeed(speed / MAX_SPEED); } }