Minor change

This commit is contained in:
SDraw 2022-09-24 08:51:48 +00:00 committed by SDraw
parent b6a4e0cd0a
commit 1928992893
No known key found for this signature in database
GPG key ID: BB95B4DAB2BB8BB5
4 changed files with 35 additions and 39 deletions

View file

@ -5,7 +5,7 @@ Merged set of MelonLoader mods for ChilloutVR.
|-----------|------------|----------------|-----------------------------------------------------------------|----------------|-------| |-----------|------------|----------------|-----------------------------------------------------------------|----------------|-------|
| Avatar Change Info | ml_aci | 1.0.2 | Yes | Working | | Avatar Change Info | ml_aci | 1.0.2 | Yes | Working |
| Avatar Motion Tweaker | ml_amt | 1.1.0 | On review | Working | | Avatar Motion Tweaker | ml_amt | 1.1.0 | On review | Working |
| Desktop Head Tracking | ml_dht | 1.0.1 | On review | Working | | Desktop Head Tracking | ml_dht | 1.0.2 | On review | Working |
| Desktop Reticle Switch | ml_drs | 1.0.0 | Yes | Working | | Desktop Reticle Switch | ml_drs | 1.0.0 | Yes | Working |
| Four Point Tracking | ml_fpt | 1.0.6 | On review | Working | | Four Point Tracking | ml_fpt | 1.0.6 | On review | Working |
| Leap Motion Extension | ml_lme | 1.1.8 | Yes | Working | | Leap Motion Extension | ml_lme | 1.1.8 | Yes | Working |

View file

@ -6,7 +6,7 @@ namespace ml_dht
{ {
class FaceTracked : MonoBehaviour class FaceTracked : MonoBehaviour
{ {
bool m_enabled = true; bool m_enabled = false;
float m_smoothing = 0.5f; float m_smoothing = 0.5f;
bool m_mirrored = false; bool m_mirrored = false;
bool m_faceOverride = true; bool m_faceOverride = true;
@ -41,20 +41,6 @@ namespace ml_dht
m_eyebrowsProgress = p_data.m_brows; m_eyebrowsProgress = p_data.m_brows;
} }
public void OnEyeControllerUpdate()
{
if(m_enabled)
{
// Gaze
PlayerSetup.Instance.eyeMovement.manualViewTarget = true;
PlayerSetup.Instance.eyeMovement.targetViewPosition = m_camera.position + m_camera.rotation * new Vector3((m_gazeDirection.x - 0.5f) * -2f, (m_gazeDirection.y - 0.5f) * 2f, 1f);
// Blink
PlayerSetup.Instance.eyeMovement.manualBlinking = true;
PlayerSetup.Instance.eyeMovement.blinkProgress = m_blinkProgress;
}
}
void OnLookIKPostUpdate() void OnLookIKPostUpdate()
{ {
if(m_enabled && (m_headBone != null)) if(m_enabled && (m_headBone != null))
@ -64,6 +50,20 @@ namespace ml_dht
} }
} }
public void OnEyeControllerUpdate(CVREyeController p_component)
{
if(m_enabled)
{
// Gaze
p_component.manualViewTarget = true;
p_component.targetViewPosition = m_camera.position + m_camera.rotation * new Vector3((m_gazeDirection.x - 0.5f) * -2f, (m_gazeDirection.y - 0.5f) * 2f, 1f);
// Blink
p_component.manualBlinking = true;
p_component.blinkProgress = m_blinkProgress;
}
}
public void OnFaceTrackingUpdate(CVRFaceTracking p_component) public void OnFaceTrackingUpdate(CVRFaceTracking p_component)
{ {
if(m_enabled && m_faceOverride) if(m_enabled && m_faceOverride)

View file

@ -124,23 +124,19 @@ namespace ml_dht
} }
} }
static void OnEyeControllerUpdate_Postfix(ref CVREyeController __instance) static void OnEyeControllerUpdate_Postfix(ref CVREyeController __instance) => ms_instance?.OnEyeControllerUpdate(__instance);
void OnEyeControllerUpdate(CVREyeController p_component)
{ {
try try
{ {
if(__instance == PlayerSetup.Instance.eyeMovement) if(p_component.isLocal && (m_localTracked != null))
ms_instance?.OnEyeControllerUpdate(); m_localTracked.OnEyeControllerUpdate(p_component);
} }
catch(System.Exception e) catch(System.Exception e)
{ {
MelonLoader.MelonLogger.Error(e); MelonLoader.MelonLogger.Error(e);
} }
} }
void OnEyeControllerUpdate()
{
if(m_localTracked != null)
m_localTracked.OnEyeControllerUpdate();
}
static void OnFaceTrackingUpdate_Postfix(ref CVRFaceTracking __instance) => ms_instance?.OnFaceTrackingUpdate(__instance); static void OnFaceTrackingUpdate_Postfix(ref CVRFaceTracking __instance) => ms_instance?.OnFaceTrackingUpdate(__instance);
void OnFaceTrackingUpdate(CVRFaceTracking p_component) void OnFaceTrackingUpdate(CVRFaceTracking p_component)

View file

@ -1,10 +1,10 @@
using System.Reflection; using System.Reflection;
[assembly: AssemblyTitle("DesktopHeadTracking")] [assembly: AssemblyTitle("DesktopHeadTracking")]
[assembly: AssemblyVersion("1.0.1")] [assembly: AssemblyVersion("1.0.2")]
[assembly: AssemblyFileVersion("1.0.1")] [assembly: AssemblyFileVersion("1.0.2")]
[assembly: MelonLoader.MelonInfo(typeof(ml_dht.DesktopHeadTracking), "DesktopHeadTracking", "1.0.1", "SDraw", "https://github.com/SDraw/ml_mods_cvr")] [assembly: MelonLoader.MelonInfo(typeof(ml_dht.DesktopHeadTracking), "DesktopHeadTracking", "1.0.2", "SDraw", "https://github.com/SDraw/ml_mods_cvr")]
[assembly: MelonLoader.MelonGame(null, "ChilloutVR")] [assembly: MelonLoader.MelonGame(null, "ChilloutVR")]
[assembly: MelonLoader.MelonPlatform(MelonLoader.MelonPlatformAttribute.CompatiblePlatforms.WINDOWS_X64)] [assembly: MelonLoader.MelonPlatform(MelonLoader.MelonPlatformAttribute.CompatiblePlatforms.WINDOWS_X64)]
[assembly: MelonLoader.MelonPlatformDomain(MelonLoader.MelonPlatformDomainAttribute.CompatibleDomains.MONO)] [assembly: MelonLoader.MelonPlatformDomain(MelonLoader.MelonPlatformDomainAttribute.CompatibleDomains.MONO)]