mirror of
https://github.com/NotAKidoS/NAK_CVR_Mods.git
synced 2025-09-02 22:39:22 +00:00
implemented scaling for specific components that Avatar Scale Tool would they conflict, if you ran your avatar through Avatar Scale Tool then the animations will add on top
42 lines
1.4 KiB
C#
42 lines
1.4 KiB
C#
using UnityEngine;
|
|
|
|
namespace NAK.AvatarScaleMod;
|
|
|
|
public static class AvatarScaleGesture
|
|
{
|
|
public static float InitialModifier = 1f;
|
|
public static float InitialTargetHeight = 1.8f;
|
|
|
|
public static void OnScaleStart(float modifier, Transform transform1, Transform transform2)
|
|
{
|
|
// AvatarScaleMod.Logger.Msg("OnScaleStart!");
|
|
|
|
if (AvatarScaleManager.LocalAvatar != null)
|
|
{
|
|
// store initial modifier
|
|
InitialModifier = modifier;
|
|
InitialTargetHeight = AvatarScaleManager.LocalAvatar.TargetHeight;
|
|
}
|
|
}
|
|
|
|
public static void OnScaleStay(float modifier, Transform transform1, Transform transform2)
|
|
{
|
|
// AvatarScaleMod.Logger.Msg("OnScaleStay!");
|
|
|
|
if (AvatarScaleManager.LocalAvatar != null)
|
|
{
|
|
float modifierRatio = modifier / InitialModifier;
|
|
|
|
// Determine the adjustment factor for the height, this will be >1 if scaling up, <1 if scaling down.
|
|
float heightAdjustmentFactor = (modifierRatio > 1) ? 1 + (modifierRatio - 1) : 1 - (1 - modifierRatio);
|
|
|
|
// Apply the adjustment to the target height
|
|
AvatarScaleManager.LocalAvatar.SetTargetHeight(InitialTargetHeight * heightAdjustmentFactor);
|
|
}
|
|
}
|
|
|
|
public static void OnScaleEnd(float modifier, Transform transform1, Transform transform2)
|
|
{
|
|
// AvatarScaleMod.Logger.Msg("OnScaleEnd!");
|
|
}
|
|
}
|