public void LateUpdate() { if (_avatar.GetHead() != null && _headAngles != null) { _avatar.GetHead().transform.localRotation = Quaternion.Euler(_headAngles); } }
public void AddMainAvatar(IAvatar avatar) { if (_mainAvatar != null) { _mainAvatar.Destroy(); } _mainAvatar = avatar; _mainAvatar.SetControls(true); _hud = new ControlHUD(_mainAvatar.GetHead()); }
public void Start() { controller.BasicMovements.Look.performed += OnLook; controller.BasicMovements.Movement.performed += OnMove; controller.BasicMovements.Movement.canceled += OnMove; controller.BasicMovements.Freelook.performed += OnFreeLook; controller.BasicMovements.Freelook.canceled += OnFreeLookStop; controller.BasicMovements.Sprint.performed += OnSprint; controller.BasicMovements.Sprint.canceled += OnSprint; controller.HUD.OpenMenu.performed += OnOpenMenu; _avatar = GetComponent <PlayerState>().Avatar; _headAngles = _avatar.GetHead().transform.localRotation.eulerAngles; }