mirror of
https://github.com/hanetzer/sdraw_mods_cvr.git
synced 2025-09-03 10:29:22 +00:00
Too many changes
This commit is contained in:
parent
45557943c4
commit
a22e5992d0
72 changed files with 1064 additions and 927 deletions
|
@ -11,7 +11,7 @@ namespace ml_amt
|
|||
[DisallowMultipleComponent]
|
||||
class MotionTweaker : MonoBehaviour
|
||||
{
|
||||
struct IKState
|
||||
struct IKInfo
|
||||
{
|
||||
public float m_weight;
|
||||
public float m_locomotionWeight;
|
||||
|
@ -20,7 +20,9 @@ namespace ml_amt
|
|||
public bool m_bendNormalRight;
|
||||
}
|
||||
|
||||
IKState m_ikState;
|
||||
static MotionTweaker ms_instance = null;
|
||||
|
||||
IKInfo m_ikInfo;
|
||||
VRIK m_vrIk = null;
|
||||
float m_avatarScale = 1f;
|
||||
Vector3 m_locomotionOffset = Vector3.zero; // Original locomotion offset
|
||||
|
@ -37,10 +39,19 @@ namespace ml_amt
|
|||
}
|
||||
|
||||
// Unity events
|
||||
void Awake()
|
||||
{
|
||||
if(ms_instance != null)
|
||||
{
|
||||
DestroyImmediate(this);
|
||||
return;
|
||||
}
|
||||
|
||||
ms_instance = this;
|
||||
DontDestroyOnLoad(this);
|
||||
}
|
||||
void Start()
|
||||
{
|
||||
DontDestroyOnLoad(this);
|
||||
|
||||
OnCrouchLimitChanged(Settings.CrouchLimit);
|
||||
OnProneLimitChanged(Settings.ProneLimit);
|
||||
|
||||
|
@ -56,6 +67,9 @@ namespace ml_amt
|
|||
|
||||
void OnDestroy()
|
||||
{
|
||||
if(ms_instance == this)
|
||||
ms_instance = null;
|
||||
|
||||
m_vrIk = null;
|
||||
m_ikLimits = null;
|
||||
m_parameters.Clear();
|
||||
|
@ -170,11 +184,11 @@ namespace ml_amt
|
|||
// IK events
|
||||
void OnIKPreSolverUpdate()
|
||||
{
|
||||
m_ikState.m_weight = m_vrIk.solver.IKPositionWeight;
|
||||
m_ikState.m_locomotionWeight = m_vrIk.solver.locomotion.weight;
|
||||
m_ikState.m_plantFeet = m_vrIk.solver.plantFeet;
|
||||
m_ikState.m_bendNormalLeft = m_vrIk.solver.leftLeg.useAnimatedBendNormal;
|
||||
m_ikState.m_bendNormalRight = m_vrIk.solver.rightLeg.useAnimatedBendNormal;
|
||||
m_ikInfo.m_weight = m_vrIk.solver.IKPositionWeight;
|
||||
m_ikInfo.m_locomotionWeight = m_vrIk.solver.locomotion.weight;
|
||||
m_ikInfo.m_plantFeet = m_vrIk.solver.plantFeet;
|
||||
m_ikInfo.m_bendNormalLeft = m_vrIk.solver.leftLeg.useAnimatedBendNormal;
|
||||
m_ikInfo.m_bendNormalRight = m_vrIk.solver.rightLeg.useAnimatedBendNormal;
|
||||
|
||||
if(!BodySystem.isCalibratedAsFullBody)
|
||||
{
|
||||
|
@ -200,11 +214,11 @@ namespace ml_amt
|
|||
|
||||
void OnIKPostSolverUpdate()
|
||||
{
|
||||
m_vrIk.solver.IKPositionWeight = m_ikState.m_weight;
|
||||
m_vrIk.solver.locomotion.weight = m_ikState.m_locomotionWeight;
|
||||
m_vrIk.solver.plantFeet = m_ikState.m_plantFeet;
|
||||
m_vrIk.solver.leftLeg.useAnimatedBendNormal = m_ikState.m_bendNormalLeft;
|
||||
m_vrIk.solver.rightLeg.useAnimatedBendNormal = m_ikState.m_bendNormalRight;
|
||||
m_vrIk.solver.IKPositionWeight = m_ikInfo.m_weight;
|
||||
m_vrIk.solver.locomotion.weight = m_ikInfo.m_locomotionWeight;
|
||||
m_vrIk.solver.plantFeet = m_ikInfo.m_plantFeet;
|
||||
m_vrIk.solver.leftLeg.useAnimatedBendNormal = m_ikInfo.m_bendNormalLeft;
|
||||
m_vrIk.solver.rightLeg.useAnimatedBendNormal = m_ikInfo.m_bendNormalRight;
|
||||
}
|
||||
|
||||
// Settings
|
||||
|
|
|
@ -6,15 +6,16 @@ namespace ml_amt
|
|||
{
|
||||
static class ResourcesHandler
|
||||
{
|
||||
readonly static string ms_namespace = typeof(ResourcesHandler).Namespace;
|
||||
|
||||
public static string GetEmbeddedResource(string p_name)
|
||||
{
|
||||
string l_result = "";
|
||||
Assembly l_assembly = Assembly.GetExecutingAssembly();
|
||||
string l_assemblyName = l_assembly.GetName().Name;
|
||||
|
||||
try
|
||||
{
|
||||
Stream l_libraryStream = l_assembly.GetManifestResourceStream(l_assemblyName + ".resources." + p_name);
|
||||
Stream l_libraryStream = l_assembly.GetManifestResourceStream(ms_namespace + ".resources." + p_name);
|
||||
StreamReader l_streadReader = new StreamReader(l_libraryStream);
|
||||
l_result = l_streadReader.ReadToEnd();
|
||||
}
|
||||
|
|
|
@ -18,20 +18,6 @@ namespace ml_amt
|
|||
|
||||
public static bool HasToes(this IKSolverVR p_instance) => (bool)ms_hasToes.GetValue(p_instance);
|
||||
|
||||
public static bool IsWorldSafe() => ((CVRWorld.Instance != null) && CVRWorld.Instance.allowFlying);
|
||||
public static float GetWorldMovementLimit()
|
||||
{
|
||||
float l_result = 1f;
|
||||
if(CVRWorld.Instance != null)
|
||||
{
|
||||
l_result = CVRWorld.Instance.baseMovementSpeed;
|
||||
l_result *= CVRWorld.Instance.sprintMultiplier;
|
||||
l_result *= CVRWorld.Instance.inAirMovementMultiplier;
|
||||
l_result *= CVRWorld.Instance.flyMultiplier;
|
||||
}
|
||||
return l_result;
|
||||
}
|
||||
|
||||
public static void ExecuteScript(this CohtmlControlledViewWrapper p_instance, string p_script) => ((cohtml.Net.View)ms_view.GetValue(p_instance)).ExecuteScript(p_script);
|
||||
|
||||
public static void SetAvatarTPose()
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
<Company>SDraw</Company>
|
||||
<Product>AvatarMotionTweaker</Product>
|
||||
<PackageId>AvatarMotionTweaker</PackageId>
|
||||
<Version>1.4.2</Version>
|
||||
<Version>1.5.0</Version>
|
||||
<Platforms>x64</Platforms>
|
||||
<AssemblyName>AvatarMotionTweaker</AssemblyName>
|
||||
</PropertyGroup>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue