mirror of
https://github.com/NotAKidoS/NAK_CVR_Mods.git
synced 2025-09-02 06:19:22 +00:00
touchups
This commit is contained in:
parent
9cc62a961c
commit
3a3cb1879c
2 changed files with 10 additions and 13 deletions
|
@ -27,18 +27,15 @@ public class BadAnimatorFix : MonoBehaviour
|
||||||
{
|
{
|
||||||
AnimatorStateInfo stateInfo = animator.GetCurrentAnimatorStateInfo(layerIndex);
|
AnimatorStateInfo stateInfo = animator.GetCurrentAnimatorStateInfo(layerIndex);
|
||||||
AnimatorTransitionInfo transitionInfo = animator.GetAnimatorTransitionInfo(layerIndex);
|
AnimatorTransitionInfo transitionInfo = animator.GetAnimatorTransitionInfo(layerIndex);
|
||||||
|
// Skip if mid-transition
|
||||||
// Skip if state doesn't loop or if mid-transition
|
if (transitionInfo.fullPathHash != 0) continue;
|
||||||
if (!stateInfo.loop || transitionInfo.fullPathHash != 0) continue;
|
// Skip if anim doesn't loop, or hasn't looped enough
|
||||||
|
if (stateInfo.normalizedTime < StateLimit) continue;
|
||||||
// Skip if state hasn't looped enough
|
// Rewind state, with 10f as buffer, to account for reasonable use of ExitTime
|
||||||
if (stateInfo.normalizedTime > StateLimit)
|
float offset = 10f + (stateInfo.normalizedTime % 1f);
|
||||||
{
|
animator.Play(stateInfo.fullPathHash, layerIndex, offset);
|
||||||
float rewindOffset = (stateInfo.normalizedTime % 1f) + 10f;
|
|
||||||
animator.Play(stateInfo.fullPathHash, layerIndex, rewindOffset);
|
|
||||||
rewound = true;
|
rewound = true;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (rewound)
|
if (rewound)
|
||||||
{
|
{
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
"loaderversion": "0.5.7",
|
"loaderversion": "0.5.7",
|
||||||
"modtype": "Mod",
|
"modtype": "Mod",
|
||||||
"author": "NotAKidoS",
|
"author": "NotAKidoS",
|
||||||
"description": "This mod occasionally rewinds animation states that have loop enabled.\n\nUnity seems to have a weird quirk where animations with loop cause performance issues after running for a long long time.\nYou'll only start to notice this after a few hours to a few days of idling.\n\nDisable loop on your 2-frame toggle clips! They cycle insanely fast and heavily contribute to this issue.",
|
"description": "This mod occasionally rewinds animation states that have loop enabled.\n\nUnity seems to have a weird quirk where *sometimes* animations with loop cause performance issues after running for a long time.\nYou'll only start to notice this after a few hours to a few days of idling.\n\nIf you don't happen to be AFK for long periods of time, you probably don't need this mod. This issue seems to be primarily caused by one-two frame animation clips meant for toggles with loop needlessly enabled.",
|
||||||
"searchtags": [
|
"searchtags": [
|
||||||
"bad",
|
"bad",
|
||||||
"fix",
|
"fix",
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue