From 3d50e64af1e5e043ecbd6961566beb50ff58186c Mon Sep 17 00:00:00 2001 From: NotAKidoS <37721153+NotAKidOnSteam@users.noreply.github.com> Date: Sun, 24 Sep 2023 06:33:52 -0500 Subject: [PATCH] [AvatarScaleMod] Quick edge-case fixes. Fix avatars without scale sliders triggering anim scale change. Fix universal scaling reaching initial height causing a reset. --- AvatarScale/AvatarScaling/Components/BaseScaler.cs | 3 +-- AvatarScale/AvatarScaling/Components/LocalScaler.cs | 6 ++++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/AvatarScale/AvatarScaling/Components/BaseScaler.cs b/AvatarScale/AvatarScaling/Components/BaseScaler.cs index 01f04df..642a9a9 100644 --- a/AvatarScale/AvatarScaling/Components/BaseScaler.cs +++ b/AvatarScale/AvatarScaling/Components/BaseScaler.cs @@ -65,8 +65,7 @@ public class BaseScaler : MonoBehaviour if (Math.Abs(height - _targetHeight) < float.Epsilon) return; - if (height < float.Epsilon - || Math.Abs(height - _initialHeight) < float.Epsilon) + if (height < float.Epsilon) { ResetHeight(); return; diff --git a/AvatarScale/AvatarScaling/Components/LocalScaler.cs b/AvatarScale/AvatarScaling/Components/LocalScaler.cs index 7ea7e23..0baaf75 100644 --- a/AvatarScale/AvatarScaling/Components/LocalScaler.cs +++ b/AvatarScale/AvatarScaling/Components/LocalScaler.cs @@ -63,9 +63,15 @@ public class LocalScaler : BaseScaler private bool CheckForAnimationScaleChange() { if (_avatarTransform == null) return false; + + //scale matches last recorded animation scale if (_avatarTransform.localScale == _legacyAnimationScale) return false; + // avatar may not have scale animation, check if it isn't equal to targetScale + if (_avatarTransform.localScale == _targetScale) + return false; + // scale was likely reset or not initiated if (_legacyAnimationScale == Vector3.zero) {