// Update is called once per frame void Update() { // Call input.Update() to facilitate the Motus-1 controller and load the next sample MotusInput.Update(); // Get the normalized translation vector Vector3 trans = MotusInput.GetNormalizedTranslation(); // Get the updated tracker rotation if we are using one Quaternion tracker = RotationTracker.GetRotation(); // Orient the Motus to the game axes coordinate system if we haven't already if (!_autoOrienter.IsOriented()) { _autoOrienter.Orient(tracker); } // Set the steering offset if we are not moving if (trans.magnitude == 0.0f) { MotusInput.SetNewSteeringOffset(tracker); } // Calculate the player rotation and apply it to the vector Quaternion rot = MotusInput.GetPlayerRotation(tracker); trans = rot * trans; trans *= speedMultiplier; // Apply the translation to the camera object transform.Translate(trans * Time.deltaTime); // un-comment this if your character is rolling over transform.localRotation = new Quaternion(0, 0, 0, 1); }
// Update is called once per frame void Update() { MotusInput.Update(); Quaternion tracker = RotationTracker.GetRotation(); if (!_autoOrienter.IsOriented()) { _autoOrienter.Orient(tracker); } Vector3 trans = MotusInput.GetNormalizedTranslation(); if (trans.magnitude == 0.0f) { MotusInput.SetNewSteeringOffset(tracker); } Quaternion rot = MotusInput.GetPlayerRotation(tracker); trans = MotusInput.GetTrim(trans) * trans; trans = rot * trans; trans *= speedMultiplier; trans += new Vector3(0, -1 * playerGravity, 0); if (playerController.isGrounded) { playerController.Move(trans * Time.deltaTime); player.transform.localRotation = new Quaternion(0, 0, 0, 1); } else { makePlayerFall(); } }