fix AMT compatability, fix error spam

Avatar Motion Tweaker looks for CheckVR bool instead of MetaPort.

Only center & disable VRIK on avatar if it is not actively loading.
This commit is contained in:
NotAKidoS 2023-01-20 02:56:13 -06:00
parent 933913bb11
commit 68716a912d

View file

@ -79,12 +79,16 @@ public class DesktopVRSwitchHelper : MonoBehaviour
public void LateUpdate() public void LateUpdate()
{ {
if (!isAttemptingSwitch) return; if (!isAttemptingSwitch) return;
BodySystem.TrackingEnabled = false;
BodySystem.TrackingPositionWeight = 0f; if (!PlayerSetup.Instance.avatarIsLoading && PlayerSetup.Instance._avatar != null)
PlayerSetup.Instance._avatar.transform.position = avatarWorldPos; {
PlayerSetup.Instance._avatar.transform.rotation = avatarWorldRot; BodySystem.TrackingEnabled = false;
MovementSystem.Instance.TeleportToPosRot(avatarWorldPos, avatarWorldRot, false); BodySystem.TrackingPositionWeight = 0f;
MovementSystem.Instance.UpdateColliderCenter(avatarWorldPos); PlayerSetup.Instance._avatar.transform.position = avatarWorldPos;
PlayerSetup.Instance._avatar.transform.rotation = avatarWorldRot;
MovementSystem.Instance.TeleportToPosRot(avatarWorldPos, avatarWorldRot, false);
MovementSystem.Instance.UpdateColliderCenter(avatarWorldPos);
}
} }
internal static IEnumerator AttemptPlatformSwitch(bool forceMode = false) internal static IEnumerator AttemptPlatformSwitch(bool forceMode = false)
@ -113,6 +117,7 @@ public class DesktopVRSwitchHelper : MonoBehaviour
yield yield
return new WaitForEndOfFrame(); return new WaitForEndOfFrame();
SetCheckVR(VRMode);
SetMetaPort(VRMode); SetMetaPort(VRMode);
//reset rich presence //reset rich presence
@ -256,6 +261,22 @@ public class DesktopVRSwitchHelper : MonoBehaviour
throw; throw;
} }
} }
internal static void SetCheckVR(bool isVR)
{
try
{
MelonLogger.Msg($"Set CheckVR hasVrDeviceLoaded to {isVR}.");
CheckVR.Instance.hasVrDeviceLoaded = isVR;
}
catch
{
MelonLogger.Error("Setting CheckVR hasVrDeviceLoaded failed. Is CheckVR.Instance invalid?");
MelonLogger.Msg("CheckVR.Instance: " + CheckVR.Instance);
throw;
}
}
internal static void SetMetaPort(bool isVR) internal static void SetMetaPort(bool isVR)
{ {
try try