using UnityEngine; using Unity.XR.CoreUtils; public class ContinousMovement : MonoBehaviour { private CharacterController character; private XROrigin rig; // Start is called before the first frame update void Start() { character = GetComponent(); rig = GetComponent(); } // Update is called once per frame void Update() { } private void FixedUpdate() { CapsuleFollorHeadset(); } void CapsuleFollorHeadset() { character.height = rig.CameraInOriginSpaceHeight; Vector3 capsuleCenter = transform.InverseTransformPoint(rig.Camera.transform.position); character.center = new Vector3(capsuleCenter.x, character.height / 2 + character.skinWidth, capsuleCenter.z); } }