mirror of
https://github.com/NotAKidoS/NAK_CVR_Mods.git
synced 2025-09-03 23:09:22 +00:00
[AvatarScaleMod] Implement scaled components.
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
This commit is contained in:
parent
44d5c7762b
commit
e8d3183bc3
7 changed files with 367 additions and 70 deletions
42
AvatarScale/AvatarScaleGesture.cs
Normal file
42
AvatarScale/AvatarScaleGesture.cs
Normal file
|
@ -0,0 +1,42 @@
|
|||
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!");
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue