[OriginShift] Nuke OriginShiftSpawnableReceiver

This commit is contained in:
NotAKidoS 2024-06-18 16:14:41 -05:00
parent 512ffe38b8
commit 373a60a9d9
3 changed files with 3 additions and 19 deletions

View file

@ -28,7 +28,6 @@ namespace NAK.OriginShift
_characterController = GetComponent<BetterBetterCharacterController>(); _characterController = GetComponent<BetterBetterCharacterController>();
#endif #endif
OriginShiftManager.OnPostOriginShifted += OnPostOriginShifted; OriginShiftManager.OnPostOriginShifted += OnPostOriginShifted;
StartCoroutine(FixedUpdateCoroutine());
} }
private void OnDestroy() private void OnDestroy()
@ -37,7 +36,7 @@ namespace NAK.OriginShift
StopAllCoroutines(); StopAllCoroutines();
} }
private void LateFixedUpdate() private void Update()
{ {
// in CVR use GetPlayerPosition to account for VR offset // in CVR use GetPlayerPosition to account for VR offset
Vector3 position = PlayerSetup.Instance.GetPlayerPosition(); Vector3 position = PlayerSetup.Instance.GetPlayerPosition();
@ -73,21 +72,5 @@ namespace NAK.OriginShift
} }
#endregion Origin Shift Events #endregion Origin Shift Events
#region LateFixedUpdate Implementation
private readonly YieldInstruction _fixedUpdateYield = new WaitForFixedUpdate();
private IEnumerator FixedUpdateCoroutine()
{
while (true)
{
yield return _fixedUpdateYield;
LateFixedUpdate(); // we need to run after all physics (specifically, character controller)
}
// ReSharper disable once IteratorNeverReturns
}
#endregion LateFixedUpdate Implementation
} }
} }

View file

@ -63,7 +63,7 @@ internal static class CVRSpawnablePatches
[HarmonyPatch(typeof(CVRSpawnable), nameof(CVRSpawnable.Start))] [HarmonyPatch(typeof(CVRSpawnable), nameof(CVRSpawnable.Start))]
private static void Postfix_CVRSpawnable_Start(ref CVRSpawnable __instance) private static void Postfix_CVRSpawnable_Start(ref CVRSpawnable __instance)
{ {
__instance.AddComponentIfMissing<OriginShiftSpawnableReceiver>(); //__instance.AddComponentIfMissing<OriginShiftSpawnableReceiver>(); //todo: investigate if this is needed
// test adding to the wrapper of the spawnable // test adding to the wrapper of the spawnable
Transform wrapper = __instance.transform.parent; Transform wrapper = __instance.transform.parent;

View file

@ -21,6 +21,7 @@ Experimental mod that allows world origin to be shifted to prevent floating poin
## Mod Incompatibilities ## Mod Incompatibilities
- PlayerRagdollMod will freak out when you ragdoll between chunk boundaries. - PlayerRagdollMod will freak out when you ragdoll between chunk boundaries.
- Partial conflict with RelativeSyncs experimental Spawnable Sync Fix.
--- ---