Actual camera point instead of offset for eyes

This commit is contained in:
SDraw 2023-04-10 00:28:41 +03:00
parent 17b1d1d9cf
commit 96ab14c698
No known key found for this signature in database
GPG key ID: BB95B4DAB2BB8BB5
2 changed files with 3 additions and 3 deletions

View file

@ -126,7 +126,7 @@ namespace ml_amt
m_moving = !Mathf.Approximately(MovementSystem.Instance.movementVector.magnitude, 0f); m_moving = !Mathf.Approximately(MovementSystem.Instance.movementVector.magnitude, 0f);
// Update upright // Update upright
Matrix4x4 l_hmdMatrix = PlayerSetup.Instance.transform.GetMatrix().inverse * (m_inVR ? PlayerSetup.Instance.vrHeadTracker.transform.GetMatrix() : PlayerSetup.Instance.desktopCameraRig.transform.GetMatrix()); Matrix4x4 l_hmdMatrix = PlayerSetup.Instance.transform.GetMatrix().inverse * PlayerSetup.Instance.GetActiveCamera().transform.GetMatrix();
float l_currentHeight = Mathf.Clamp((l_hmdMatrix * ms_pointVector).y, 0f, float.MaxValue); float l_currentHeight = Mathf.Clamp((l_hmdMatrix * ms_pointVector).y, 0f, float.MaxValue);
float l_avatarViewHeight = Mathf.Clamp(m_viewPointHeight * GetRelativeScale(), 0f, float.MaxValue); float l_avatarViewHeight = Mathf.Clamp(m_viewPointHeight * GetRelativeScale(), 0f, float.MaxValue);
m_upright = Mathf.Clamp01((l_avatarViewHeight > 0f) ? (l_currentHeight / l_avatarViewHeight) : 0f); m_upright = Mathf.Clamp01((l_avatarViewHeight > 0f) ? (l_currentHeight / l_avatarViewHeight) : 0f);

View file

@ -1,5 +1,5 @@
using UnityEngine; using System.Reflection;
using System.Reflection; using UnityEngine;
namespace ml_amt namespace ml_amt
{ {