mirror of
https://github.com/hanetzer/sdraw_mods_cvr.git
synced 2025-09-05 11:29:23 +00:00
Instance set changes
Additional animator parameters Reworked rigidbodies Update to latest LeapC and LeapCSharp
This commit is contained in:
parent
1f0b518761
commit
075ff67304
38 changed files with 8310 additions and 8646 deletions
10
README.md
10
README.md
|
@ -3,14 +3,14 @@ Merged set of MelonLoader mods for ChilloutVR.
|
||||||
**Table for game build 2023r175:**
|
**Table for game build 2023r175:**
|
||||||
| Full name | Short name | Latest version |
|
| Full name | Short name | Latest version |
|
||||||
|:---------:|:----------:|:--------------:|
|
|:---------:|:----------:|:--------------:|
|
||||||
| [Avatar Motion Tweaker](/ml_amt/README.md) | ml_amt | 1.4.0 [:arrow_down:](../../releases/latest/download/ml_amt.dll)|
|
| [Avatar Motion Tweaker](/ml_amt/README.md) | ml_amt | 1.4.1 [:arrow_down:](../../releases/latest/download/ml_amt.dll)|
|
||||||
| [Avatar Synced Look](/ml_asl/README.md) | ml_asl | 1.0.4 [:arrow_down:](../../releases/latest/download/ml_asl.dll)|
|
| [Avatar Synced Look](/ml_asl/README.md) | ml_asl | 1.0.4 [:arrow_down:](../../releases/latest/download/ml_asl.dll)|
|
||||||
| [Better Fingers Tracking](/ml_bft/README.md) | ml_bft | 1.0.4 [:arrow_down:](../../releases/latest/download/ml_bft.dll)|
|
| [Better Fingers Tracking](/ml_bft/README.md) | ml_bft | 1.0.4 [:arrow_down:](../../releases/latest/download/ml_bft.dll)|
|
||||||
| [Desktop Head Tracking](/ml_dht/README.md) | ml_dht | 1.2.4 [:arrow_down:](../../releases/latest/download/ml_dht.dll)|
|
| [Desktop Head Tracking](/ml_dht/README.md) | ml_dht | 1.2.5 [:arrow_down:](../../releases/latest/download/ml_dht.dll)|
|
||||||
| [Leap Motion Extension](/ml_lme/README.md)| ml_lme | 1.5.1 [:arrow_down:](../../releases/latest/download/ml_lme.dll)|
|
| [Leap Motion Extension](/ml_lme/README.md)| ml_lme | 1.5.2 [:arrow_down:](../../releases/latest/download/ml_lme.dll)|
|
||||||
| [Pickup Arm Movement](/ml_pam/README.md)| ml_pam | 1.1.3 [:arrow_down:](../../releases/latest/download/ml_pam.dll)|
|
| [Pickup Arm Movement](/ml_pam/README.md)| ml_pam | 1.1.4 [:arrow_down:](../../releases/latest/download/ml_pam.dll)|
|
||||||
| [Player Movement Copycat](/ml_pmc/README.md)| ml_pmc | 1.0.8 [:arrow_down:](../../releases/latest/download/ml_pmc.dll)|
|
| [Player Movement Copycat](/ml_pmc/README.md)| ml_pmc | 1.0.8 [:arrow_down:](../../releases/latest/download/ml_pmc.dll)|
|
||||||
| [Player Ragdoll Mod](/ml_prm/README.md) | ml_prm | 1.1.7 [:arrow_down:](../../releases/latest/download/ml_prm.dll)|
|
| [Player Ragdoll Mod](/ml_prm/README.md) | ml_prm | 1.1.8 [:arrow_down:](../../releases/latest/download/ml_prm.dll)|
|
||||||
| [Players Instance Notifier](/ml_pin/README.md) | ml_pin | 1.0.7 [:arrow_down:](../../releases/latest/download/ml_ml_pin.dll)|
|
| [Players Instance Notifier](/ml_pin/README.md) | ml_pin | 1.0.7 [:arrow_down:](../../releases/latest/download/ml_ml_pin.dll)|
|
||||||
| [Vive Extended Input](/ml_vei/README.md) | ml_vei | 1.0.4 [:arrow_down:](../../releases/latest/download/ml_vei.dll)|
|
| [Vive Extended Input](/ml_vei/README.md) | ml_vei | 1.0.4 [:arrow_down:](../../releases/latest/download/ml_vei.dll)|
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
[assembly: MelonLoader.MelonInfo(typeof(ml_amt.AvatarMotionTweaker), "AvatarMotionTweaker", "1.4.0", "SDraw", "https://github.com/SDraw/ml_mods_cvr")]
|
[assembly: MelonLoader.MelonInfo(typeof(ml_amt.AvatarMotionTweaker), "AvatarMotionTweaker", "1.4.1", "SDraw", "https://github.com/SDraw/ml_mods_cvr")]
|
||||||
[assembly: MelonLoader.MelonGame(null, "ChilloutVR")]
|
[assembly: MelonLoader.MelonGame(null, "ChilloutVR")]
|
||||||
[assembly: MelonLoader.MelonPlatform(MelonLoader.MelonPlatformAttribute.CompatiblePlatforms.WINDOWS_X64)]
|
[assembly: MelonLoader.MelonPlatform(MelonLoader.MelonPlatformAttribute.CompatiblePlatforms.WINDOWS_X64)]
|
||||||
[assembly: MelonLoader.MelonPlatformDomain(MelonLoader.MelonPlatformDomainAttribute.CompatibleDomains.MONO)]
|
[assembly: MelonLoader.MelonPlatformDomain(MelonLoader.MelonPlatformDomainAttribute.CompatibleDomains.MONO)]
|
||||||
|
|
|
@ -35,11 +35,14 @@ namespace ml_amt
|
||||||
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 ExecuteScript(this CohtmlControlledViewWrapper p_instance, string p_script) => ((cohtml.Net.View)ms_view.GetValue(p_instance)).ExecuteScript(p_script);
|
||||||
|
|
||||||
public static void SetAvatarTPose()
|
public static void SetAvatarTPose()
|
||||||
|
{
|
||||||
|
if(PlayerSetup.Instance._animator.isHuman)
|
||||||
{
|
{
|
||||||
IKSystem.Instance.SetAvatarPose(IKSystem.AvatarPose.TPose);
|
IKSystem.Instance.SetAvatarPose(IKSystem.AvatarPose.TPose);
|
||||||
PlayerSetup.Instance._avatar.transform.localPosition = Vector3.zero;
|
PlayerSetup.Instance._avatar.transform.localPosition = Vector3.zero;
|
||||||
PlayerSetup.Instance._avatar.transform.localRotation = Quaternion.identity;
|
PlayerSetup.Instance._avatar.transform.localRotation = Quaternion.identity;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Engine extensions
|
// Engine extensions
|
||||||
public static Matrix4x4 GetMatrix(this Transform p_transform, bool p_pos = true, bool p_rot = true, bool p_scl = false)
|
public static Matrix4x4 GetMatrix(this Transform p_transform, bool p_pos = true, bool p_rot = true, bool p_scl = false)
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
<Company>None</Company>
|
<Company>None</Company>
|
||||||
<Product>AvatarMotionTweaker</Product>
|
<Product>AvatarMotionTweaker</Product>
|
||||||
<PackageId>AvatarMotionTweaker</PackageId>
|
<PackageId>AvatarMotionTweaker</PackageId>
|
||||||
<Version>1.4.0</Version>
|
<Version>1.4.1</Version>
|
||||||
<Platforms>x64</Platforms>
|
<Platforms>x64</Platforms>
|
||||||
<AssemblyName>ml_amt</AssemblyName>
|
<AssemblyName>ml_amt</AssemblyName>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
[assembly: MelonLoader.MelonInfo(typeof(ml_dht.DesktopHeadTracking), "DesktopHeadTracking", "1.2.4", "SDraw", "https://github.com/SDraw/ml_mods_cvr")]
|
[assembly: MelonLoader.MelonInfo(typeof(ml_dht.DesktopHeadTracking), "DesktopHeadTracking", "1.2.5", "SDraw", "https://github.com/SDraw/ml_mods_cvr")]
|
||||||
[assembly: MelonLoader.MelonGame(null, "ChilloutVR")]
|
[assembly: MelonLoader.MelonGame(null, "ChilloutVR")]
|
||||||
[assembly: MelonLoader.MelonPlatform(MelonLoader.MelonPlatformAttribute.CompatiblePlatforms.WINDOWS_X64)]
|
[assembly: MelonLoader.MelonPlatform(MelonLoader.MelonPlatformAttribute.CompatiblePlatforms.WINDOWS_X64)]
|
||||||
[assembly: MelonLoader.MelonPlatformDomain(MelonLoader.MelonPlatformDomainAttribute.CompatibleDomains.MONO)]
|
[assembly: MelonLoader.MelonPlatformDomain(MelonLoader.MelonPlatformDomainAttribute.CompatibleDomains.MONO)]
|
|
@ -18,10 +18,13 @@ namespace ml_dht
|
||||||
public static void UpdateShapesLocal_Private(this CVRFaceTracking p_instance) => ms_updateShapesLocal?.Invoke(p_instance, ms_emptyArray);
|
public static void UpdateShapesLocal_Private(this CVRFaceTracking p_instance) => ms_updateShapesLocal?.Invoke(p_instance, ms_emptyArray);
|
||||||
|
|
||||||
public static void SetAvatarTPose()
|
public static void SetAvatarTPose()
|
||||||
|
{
|
||||||
|
if(PlayerSetup.Instance._animator.isHuman)
|
||||||
{
|
{
|
||||||
IKSystem.Instance.SetAvatarPose(IKSystem.AvatarPose.TPose);
|
IKSystem.Instance.SetAvatarPose(IKSystem.AvatarPose.TPose);
|
||||||
PlayerSetup.Instance._avatar.transform.localPosition = Vector3.zero;
|
PlayerSetup.Instance._avatar.transform.localPosition = Vector3.zero;
|
||||||
PlayerSetup.Instance._avatar.transform.localRotation = Quaternion.identity;
|
PlayerSetup.Instance._avatar.transform.localRotation = Quaternion.identity;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
<Authors>SDraw</Authors>
|
<Authors>SDraw</Authors>
|
||||||
<Company>None</Company>
|
<Company>None</Company>
|
||||||
<Product>DesktopHeadTracking</Product>
|
<Product>DesktopHeadTracking</Product>
|
||||||
<Version>1.2.4</Version>
|
<Version>1.2.5</Version>
|
||||||
<Platforms>x64</Platforms>
|
<Platforms>x64</Platforms>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
|
|
|
@ -19,16 +19,22 @@ namespace ml_lme
|
||||||
|
|
||||||
void Awake()
|
void Awake()
|
||||||
{
|
{
|
||||||
if(Instance == null)
|
if((Instance != null) && (Instance != this))
|
||||||
|
{
|
||||||
|
Object.DestroyImmediate(this);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
Instance = this;
|
Instance = this;
|
||||||
|
|
||||||
ScriptableObject.CreateInstance<Leap.Unity.UltraleapSettings>().ResetToDefaults();
|
|
||||||
|
|
||||||
m_leapController = new Leap.Controller();
|
|
||||||
m_leapData = new LeapParser.LeapData();
|
|
||||||
|
|
||||||
DontDestroyOnLoad(this);
|
DontDestroyOnLoad(this);
|
||||||
|
|
||||||
|
ScriptableObject.CreateInstance<Leap.Unity.UltraleapSettings>().ResetToDefaults();
|
||||||
|
m_leapController = new Leap.Controller();
|
||||||
|
m_leapData = new LeapParser.LeapData();
|
||||||
|
}
|
||||||
|
|
||||||
|
void Start()
|
||||||
|
{
|
||||||
m_leapController.Device += this.OnLeapDeviceInitialized;
|
m_leapController.Device += this.OnLeapDeviceInitialized;
|
||||||
m_leapController.DeviceFailure += this.OnLeapDeviceFailure;
|
m_leapController.DeviceFailure += this.OnLeapDeviceFailure;
|
||||||
m_leapController.DeviceLost += this.OnLeapDeviceLost;
|
m_leapController.DeviceLost += this.OnLeapDeviceLost;
|
||||||
|
|
|
@ -26,9 +26,13 @@ namespace ml_lme
|
||||||
|
|
||||||
void Start()
|
void Start()
|
||||||
{
|
{
|
||||||
if(Instance == null)
|
if((Instance != null) && (Instance != this))
|
||||||
Instance = this;
|
{
|
||||||
|
Object.DestroyImmediate(this);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Instance = this;
|
||||||
m_inVR = Utils.IsInVR();
|
m_inVR = Utils.IsInVR();
|
||||||
|
|
||||||
m_leapElbowLeft = new GameObject("LeapElbowLeft").transform;
|
m_leapElbowLeft = new GameObject("LeapElbowLeft").transform;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
[assembly: MelonLoader.MelonInfo(typeof(ml_lme.LeapMotionExtension), "LeapMotionExtension", "1.5.1", "SDraw", "https://github.com/SDraw/ml_mods_cvr")]
|
[assembly: MelonLoader.MelonInfo(typeof(ml_lme.LeapMotionExtension), "LeapMotionExtension", "1.5.2", "SDraw", "https://github.com/SDraw/ml_mods_cvr")]
|
||||||
[assembly: MelonLoader.MelonGame(null, "ChilloutVR")]
|
[assembly: MelonLoader.MelonGame(null, "ChilloutVR")]
|
||||||
[assembly: MelonLoader.MelonOptionalDependencies("ml_pmc")]
|
[assembly: MelonLoader.MelonOptionalDependencies("ml_pmc")]
|
||||||
[assembly: MelonLoader.MelonPlatform(MelonLoader.MelonPlatformAttribute.CompatiblePlatforms.WINDOWS_X64)]
|
[assembly: MelonLoader.MelonPlatform(MelonLoader.MelonPlatformAttribute.CompatiblePlatforms.WINDOWS_X64)]
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
<TargetFramework>netstandard2.1</TargetFramework>
|
<TargetFramework>netstandard2.1</TargetFramework>
|
||||||
<Platforms>x64</Platforms>
|
<Platforms>x64</Platforms>
|
||||||
<PackageId>LeapMotionExtension</PackageId>
|
<PackageId>LeapMotionExtension</PackageId>
|
||||||
<Version>1.5.1</Version>
|
<Version>1.5.2</Version>
|
||||||
<Authors>SDraw</Authors>
|
<Authors>SDraw</Authors>
|
||||||
<Company>None</Company>
|
<Company>None</Company>
|
||||||
<Product>LeapMotionExtension</Product>
|
<Product>LeapMotionExtension</Product>
|
||||||
|
|
67
ml_lme/vendor/LeapCSharp/Connection.cs
vendored
67
ml_lme/vendor/LeapCSharp/Connection.cs
vendored
|
@ -13,6 +13,7 @@ namespace LeapInternal
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
public class Connection
|
public class Connection
|
||||||
{
|
{
|
||||||
|
@ -1195,11 +1196,7 @@ namespace LeapInternal
|
||||||
return new UnityEngine.Vector3(ray.x, ray.y, ray.z);
|
return new UnityEngine.Vector3(ray.x, ray.y, ray.z);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
[Obsolete("calibType is not necessary. Please use the alternative PixelToRectilinearEx method.")]
|
||||||
/// Converts from image-space pixel coordinates to camera-space rectilinear coordinates
|
|
||||||
///
|
|
||||||
/// Also allows specifying a specific device handle and calibration type.
|
|
||||||
/// </summary>
|
|
||||||
public UnityEngine.Vector3 PixelToRectilinearEx(IntPtr deviceHandle,
|
public UnityEngine.Vector3 PixelToRectilinearEx(IntPtr deviceHandle,
|
||||||
Image.CameraType camera, Image.CalibrationType calibType, UnityEngine.Vector3 pixel)
|
Image.CameraType camera, Image.CalibrationType calibType, UnityEngine.Vector3 pixel)
|
||||||
{
|
{
|
||||||
|
@ -1216,6 +1213,24 @@ namespace LeapInternal
|
||||||
return new UnityEngine.Vector3(ray.x, ray.y, ray.z);
|
return new UnityEngine.Vector3(ray.x, ray.y, ray.z);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Converts from image-space pixel coordinates to camera-space rectilinear coordinates
|
||||||
|
///
|
||||||
|
/// Also allows specifying a specific device handle and calibration type.
|
||||||
|
/// </summary>
|
||||||
|
public UnityEngine.Vector3 PixelToRectilinearEx(IntPtr deviceHandle,
|
||||||
|
Image.CameraType camera, UnityEngine.Vector3 pixel)
|
||||||
|
{
|
||||||
|
LEAP_VECTOR pixelStruct = new LEAP_VECTOR(pixel);
|
||||||
|
LEAP_VECTOR ray = LeapC.LeapPixelToRectilinearEx(_leapConnection,
|
||||||
|
deviceHandle,
|
||||||
|
(camera == Image.CameraType.LEFT ?
|
||||||
|
eLeapPerspectiveType.eLeapPerspectiveType_stereo_left :
|
||||||
|
eLeapPerspectiveType.eLeapPerspectiveType_stereo_right),
|
||||||
|
pixelStruct);
|
||||||
|
return new UnityEngine.Vector3(ray.x, ray.y, ray.z);
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Converts from camera-space rectilinear coordinates to image-space pixel coordinates
|
/// Converts from camera-space rectilinear coordinates to image-space pixel coordinates
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -1302,6 +1317,48 @@ namespace LeapInternal
|
||||||
Marshal.FreeHGlobal(buffer);
|
Marshal.FreeHGlobal(buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Request the Extrinsic Camera Matrix
|
||||||
|
/// </summary>
|
||||||
|
public Matrix4x4 LeapExtrinsicCameraMatrix(Image.CameraType camera, Device device)
|
||||||
|
{
|
||||||
|
float[] data = new float[16];
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
eLeapRS result = eLeapRS.eLeapRS_Success;
|
||||||
|
|
||||||
|
if (device != null)
|
||||||
|
{
|
||||||
|
result = LeapC.LeapExtrinsicCameraMatrixEx(_leapConnection, device.Handle, camera == Image.CameraType.LEFT ?
|
||||||
|
eLeapPerspectiveType.eLeapPerspectiveType_stereo_left :
|
||||||
|
eLeapPerspectiveType.eLeapPerspectiveType_stereo_right, data);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
result = LeapC.LeapExtrinsicCameraMatrix(_leapConnection, camera == Image.CameraType.LEFT ?
|
||||||
|
eLeapPerspectiveType.eLeapPerspectiveType_stereo_left :
|
||||||
|
eLeapPerspectiveType.eLeapPerspectiveType_stereo_right, data);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (result != eLeapRS.eLeapRS_Success)
|
||||||
|
{
|
||||||
|
return new Matrix4x4(new Vector4(data[0], data[1], data[2], data[3]),
|
||||||
|
new Vector4(data[4], data[5], data[6], data[7]),
|
||||||
|
new Vector4(data[8], data[9], data[10], data[11]),
|
||||||
|
new Vector4(data[12], data[13], data[14], data[15])
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
Debug.LogException(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
return Matrix4x4.identity;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Send a specific set of hints to hDevice, if this does not include previously set ones, they will be cleared.
|
/// Send a specific set of hints to hDevice, if this does not include previously set ones, they will be cleared.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
20
ml_lme/vendor/LeapCSharp/Controller.cs
vendored
20
ml_lme/vendor/LeapCSharp/Controller.cs
vendored
|
@ -863,6 +863,26 @@ namespace Leap
|
||||||
_connection.GetInterpolatedFrameFromTime(toFill, time, sourceTime, device);
|
_connection.GetInterpolatedFrameFromTime(toFill, time, sourceTime, device);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public UnityEngine.Matrix4x4 LeapExtrinsicCameraMatrix(Image.CameraType camera, Device device)
|
||||||
|
{
|
||||||
|
return _connection.LeapExtrinsicCameraMatrix(camera, device);
|
||||||
|
}
|
||||||
|
|
||||||
|
public UnityEngine.Vector3 RectilinearToPixel(Image.CameraType camera, UnityEngine.Vector3 ray)
|
||||||
|
{
|
||||||
|
return _connection.RectilinearToPixel(camera, ray);
|
||||||
|
}
|
||||||
|
|
||||||
|
public UnityEngine.Vector3 RectilinearToPixelEx(Image.CameraType camera, UnityEngine.Vector3 ray, Device device)
|
||||||
|
{
|
||||||
|
return _connection.RectilinearToPixelEx(device.Handle, camera, ray);
|
||||||
|
}
|
||||||
|
|
||||||
|
public UnityEngine.Vector3 PixelToRectilinearEx(Image.CameraType camera, UnityEngine.Vector3 pixel, Device device)
|
||||||
|
{
|
||||||
|
return _connection.PixelToRectilinearEx(device.Handle, camera, pixel);
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns a timestamp value as close as possible to the current time.
|
/// Returns a timestamp value as close as possible to the current time.
|
||||||
/// Values are in microseconds, as with all the other timestamp values.
|
/// Values are in microseconds, as with all the other timestamp values.
|
||||||
|
|
|
@ -14,9 +14,6 @@ namespace LeapInternal
|
||||||
{
|
{
|
||||||
public static readonly float MM_TO_M = 1e-3f;
|
public static readonly float MM_TO_M = 1e-3f;
|
||||||
|
|
||||||
public static bool leapToUnityTransformSet = false;
|
|
||||||
private static LeapTransform leapToUnityTransform;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides a static LeapTransform that converts from Leap units and coordinates to Unity
|
* Provides a static LeapTransform that converts from Leap units and coordinates to Unity
|
||||||
*/
|
*/
|
||||||
|
@ -24,12 +21,8 @@ namespace LeapInternal
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
if (!leapToUnityTransformSet)
|
LeapTransform leapToUnityTransform = new LeapTransform(Vector3.zero, Quaternion.identity, new Vector3(MM_TO_M, MM_TO_M, MM_TO_M));
|
||||||
{
|
|
||||||
leapToUnityTransform = new LeapTransform(Vector3.zero, Quaternion.identity, new Vector3(MM_TO_M, MM_TO_M, MM_TO_M));
|
|
||||||
leapToUnityTransform.MirrorZ();
|
leapToUnityTransform.MirrorZ();
|
||||||
leapToUnityTransformSet = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return leapToUnityTransform;
|
return leapToUnityTransform;
|
||||||
}
|
}
|
||||||
|
|
15
ml_lme/vendor/LeapCSharp/LeapC.cs
vendored
15
ml_lme/vendor/LeapCSharp/LeapC.cs
vendored
|
@ -1133,10 +1133,14 @@ namespace LeapInternal
|
||||||
public static extern LEAP_VECTOR LeapPixelToRectilinear(IntPtr hConnection,
|
public static extern LEAP_VECTOR LeapPixelToRectilinear(IntPtr hConnection,
|
||||||
eLeapPerspectiveType camera, LEAP_VECTOR pixel);
|
eLeapPerspectiveType camera, LEAP_VECTOR pixel);
|
||||||
|
|
||||||
[DllImport("LeapC", EntryPoint = "LeapPixelToRectilinearEx")]
|
[Obsolete("Use of calibrationType is not valid. Use alternative LeapPixelToRectilinearEx method."), DllImport("LeapC", EntryPoint = "LeapPixelToRectilinearEx")]
|
||||||
public static extern LEAP_VECTOR LeapPixelToRectilinearEx(IntPtr hConnection,
|
public static extern LEAP_VECTOR LeapPixelToRectilinearEx(IntPtr hConnection,
|
||||||
IntPtr hDevice, eLeapPerspectiveType camera, eLeapCameraCalibrationType calibrationType, LEAP_VECTOR pixel);
|
IntPtr hDevice, eLeapPerspectiveType camera, eLeapCameraCalibrationType calibrationType, LEAP_VECTOR pixel);
|
||||||
|
|
||||||
|
[DllImport("LeapC", EntryPoint = "LeapPixelToRectilinearEx")]
|
||||||
|
public static extern LEAP_VECTOR LeapPixelToRectilinearEx(IntPtr hConnection,
|
||||||
|
IntPtr hDevice, eLeapPerspectiveType camera, LEAP_VECTOR pixel);
|
||||||
|
|
||||||
[DllImport("LeapC", EntryPoint = "LeapRectilinearToPixel")]
|
[DllImport("LeapC", EntryPoint = "LeapRectilinearToPixel")]
|
||||||
public static extern LEAP_VECTOR LeapRectilinearToPixel(IntPtr hConnection,
|
public static extern LEAP_VECTOR LeapRectilinearToPixel(IntPtr hConnection,
|
||||||
eLeapPerspectiveType camera, LEAP_VECTOR rectilinear);
|
eLeapPerspectiveType camera, LEAP_VECTOR rectilinear);
|
||||||
|
@ -1145,6 +1149,14 @@ namespace LeapInternal
|
||||||
public static extern LEAP_VECTOR LeapRectilinearToPixelEx(IntPtr hConnection,
|
public static extern LEAP_VECTOR LeapRectilinearToPixelEx(IntPtr hConnection,
|
||||||
IntPtr hDevice, eLeapPerspectiveType camera, LEAP_VECTOR rectilinear);
|
IntPtr hDevice, eLeapPerspectiveType camera, LEAP_VECTOR rectilinear);
|
||||||
|
|
||||||
|
[DllImport("LeapC", EntryPoint = "LeapExtrinsicCameraMatrix")]
|
||||||
|
public static extern eLeapRS LeapExtrinsicCameraMatrix(IntPtr hConnection, eLeapPerspectiveType camera,
|
||||||
|
[MarshalAs(UnmanagedType.LPArray, SizeConst = 16)] float[] extrinsicMatrix);
|
||||||
|
|
||||||
|
[DllImport("LeapC", EntryPoint = "LeapExtrinsicCameraMatrixEx")]
|
||||||
|
public static extern eLeapRS LeapExtrinsicCameraMatrixEx(IntPtr hConnection, IntPtr hDevice, eLeapPerspectiveType camera,
|
||||||
|
[MarshalAs(UnmanagedType.LPArray, SizeConst = 16)] float[] extrinsicMatrix);
|
||||||
|
|
||||||
[DllImport("LeapC", EntryPoint = "LeapCloseDevice")]
|
[DllImport("LeapC", EntryPoint = "LeapCloseDevice")]
|
||||||
public static extern void CloseDevice(IntPtr pDevice);
|
public static extern void CloseDevice(IntPtr pDevice);
|
||||||
|
|
||||||
|
@ -1273,7 +1285,6 @@ namespace LeapInternal
|
||||||
[DllImport("LeapC", EntryPoint = "LeapGetVersion")]
|
[DllImport("LeapC", EntryPoint = "LeapGetVersion")]
|
||||||
public static extern eLeapRS GetVersion(IntPtr hConnection, eLeapVersionPart versionPart, ref LEAP_VERSION pVersion);
|
public static extern eLeapRS GetVersion(IntPtr hConnection, eLeapVersionPart versionPart, ref LEAP_VERSION pVersion);
|
||||||
|
|
||||||
|
|
||||||
[DllImport("LeapC", EntryPoint = "LeapGetServerStatus")]
|
[DllImport("LeapC", EntryPoint = "LeapGetServerStatus")]
|
||||||
public static extern eLeapRS GetServerStatus(UInt32 timeout, ref IntPtr status);
|
public static extern eLeapRS GetServerStatus(UInt32 timeout, ref IntPtr status);
|
||||||
|
|
||||||
|
|
8
ml_lme/vendor/LeapCSharp/ServerStatus.cs
vendored
8
ml_lme/vendor/LeapCSharp/ServerStatus.cs
vendored
|
@ -25,12 +25,16 @@ namespace LeapInternal
|
||||||
if (lastRequestTimestamp + requestInterval < Time.realtimeSinceStartup)
|
if (lastRequestTimestamp + requestInterval < Time.realtimeSinceStartup)
|
||||||
{
|
{
|
||||||
IntPtr statusPtr = new IntPtr();
|
IntPtr statusPtr = new IntPtr();
|
||||||
LeapC.GetServerStatus(1000, ref statusPtr);
|
LeapC.GetServerStatus(500, ref statusPtr);
|
||||||
|
|
||||||
|
if (statusPtr != IntPtr.Zero)
|
||||||
|
{
|
||||||
lastStatus = Marshal.PtrToStructure<LeapC.LEAP_SERVER_STATUS>(statusPtr);
|
lastStatus = Marshal.PtrToStructure<LeapC.LEAP_SERVER_STATUS>(statusPtr);
|
||||||
|
|
||||||
MarshalUnmananagedArray2Struct(lastStatus.devices, (int)lastStatus.device_count, out lastDevices);
|
MarshalUnmananagedArray2Struct(lastStatus.devices, (int)lastStatus.device_count, out lastDevices);
|
||||||
LeapC.ReleaseServerStatus(ref lastStatus);
|
LeapC.ReleaseServerStatus(ref lastStatus);
|
||||||
|
}
|
||||||
|
|
||||||
lastRequestTimestamp = Time.realtimeSinceStartup;
|
lastRequestTimestamp = Time.realtimeSinceStartup;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -97,7 +101,7 @@ namespace LeapInternal
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void MarshalUnmananagedArray2Struct<T>(IntPtr unmanagedArray, int length, out T[] mangagedArray)
|
static void MarshalUnmananagedArray2Struct<T>(IntPtr unmanagedArray, int length, out T[] mangagedArray)
|
||||||
{
|
{
|
||||||
var size = Marshal.SizeOf(typeof(T));
|
var size = Marshal.SizeOf(typeof(T));
|
||||||
mangagedArray = new T[length];
|
mangagedArray = new T[length];
|
||||||
|
|
512
ml_lme/vendor/LeapSDK/ThirdPartyNotices.md
vendored
512
ml_lme/vendor/LeapSDK/ThirdPartyNotices.md
vendored
|
@ -6769,515 +6769,3 @@ ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
```
|
```
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
libusb (1.0.23) - GNU LGPL (2.1)
|
|
||||||
===============================================================================
|
|
||||||
```
|
|
||||||
|
|
||||||
GNU LESSER GENERAL PUBLIC LICENSE
|
|
||||||
Version 2.1, February 1999
|
|
||||||
|
|
||||||
Copyright (C) 1991, 1999 Free Software Foundation, Inc.
|
|
||||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
||||||
Everyone is permitted to copy and distribute verbatim copies
|
|
||||||
of this license document, but changing it is not allowed.
|
|
||||||
|
|
||||||
[This is the first released version of the Lesser GPL. It also counts
|
|
||||||
as the successor of the GNU Library Public License, version 2, hence
|
|
||||||
the version number 2.1.]
|
|
||||||
|
|
||||||
Preamble
|
|
||||||
|
|
||||||
The licenses for most software are designed to take away your
|
|
||||||
freedom to share and change it. By contrast, the GNU General Public
|
|
||||||
Licenses are intended to guarantee your freedom to share and change
|
|
||||||
free software--to make sure the software is free for all its users.
|
|
||||||
|
|
||||||
This license, the Lesser General Public License, applies to some
|
|
||||||
specially designated software packages--typically libraries--of the
|
|
||||||
Free Software Foundation and other authors who decide to use it. You
|
|
||||||
can use it too, but we suggest you first think carefully about whether
|
|
||||||
this license or the ordinary General Public License is the better
|
|
||||||
strategy to use in any particular case, based on the explanations below.
|
|
||||||
|
|
||||||
When we speak of free software, we are referring to freedom of use,
|
|
||||||
not price. Our General Public Licenses are designed to make sure that
|
|
||||||
you have the freedom to distribute copies of free software (and charge
|
|
||||||
for this service if you wish) that you receive source code or can get
|
|
||||||
it if you want it that you can change the software and use pieces of
|
|
||||||
it in new free programs and that you are informed that you can do
|
|
||||||
these things.
|
|
||||||
|
|
||||||
To protect your rights, we need to make restrictions that forbid
|
|
||||||
distributors to deny you these rights or to ask you to surrender these
|
|
||||||
rights. These restrictions translate to certain responsibilities for
|
|
||||||
you if you distribute copies of the library or if you modify it.
|
|
||||||
|
|
||||||
For example, if you distribute copies of the library, whether gratis
|
|
||||||
or for a fee, you must give the recipients all the rights that we gave
|
|
||||||
you. You must make sure that they, too, receive or can get the source
|
|
||||||
code. If you link other code with the library, you must provide
|
|
||||||
complete object files to the recipients, so that they can relink them
|
|
||||||
with the library after making changes to the library and recompiling
|
|
||||||
it. And you must show them these terms so they know their rights.
|
|
||||||
|
|
||||||
We protect your rights with a two-step method: (1) we copyright the
|
|
||||||
library, and (2) we offer you this license, which gives you legal
|
|
||||||
permission to copy, distribute and/or modify the library.
|
|
||||||
|
|
||||||
To protect each distributor, we want to make it very clear that
|
|
||||||
there is no warranty for the free library. Also, if the library is
|
|
||||||
modified by someone else and passed on, the recipients should know
|
|
||||||
that what they have is not the original version, so that the original
|
|
||||||
author's reputation will not be affected by problems that might be
|
|
||||||
introduced by others.
|
|
||||||
|
|
||||||
Finally, software patents pose a constant threat to the existence of
|
|
||||||
any free program. We wish to make sure that a company cannot
|
|
||||||
effectively restrict the users of a free program by obtaining a
|
|
||||||
restrictive license from a patent holder. Therefore, we insist that
|
|
||||||
any patent license obtained for a version of the library must be
|
|
||||||
consistent with the full freedom of use specified in this license.
|
|
||||||
|
|
||||||
Most GNU software, including some libraries, is covered by the
|
|
||||||
ordinary GNU General Public License. This license, the GNU Lesser
|
|
||||||
General Public License, applies to certain designated libraries, and
|
|
||||||
is quite different from the ordinary General Public License. We use
|
|
||||||
this license for certain libraries in order to permit linking those
|
|
||||||
libraries into non-free programs.
|
|
||||||
|
|
||||||
When a program is linked with a library, whether statically or using
|
|
||||||
a shared library, the combination of the two is legally speaking a
|
|
||||||
combined work, a derivative of the original library. The ordinary
|
|
||||||
General Public License therefore permits such linking only if the
|
|
||||||
entire combination fits its criteria of freedom. The Lesser General
|
|
||||||
Public License permits more lax criteria for linking other code with
|
|
||||||
the library.
|
|
||||||
|
|
||||||
We call this license the "Lesser" General Public License because it
|
|
||||||
does Less to protect the user's freedom than the ordinary General
|
|
||||||
Public License. It also provides other free software developers Less
|
|
||||||
of an advantage over competing non-free programs. These disadvantages
|
|
||||||
are the reason we use the ordinary General Public License for many
|
|
||||||
libraries. However, the Lesser license provides advantages in certain
|
|
||||||
special circumstances.
|
|
||||||
|
|
||||||
For example, on rare occasions, there may be a special need to
|
|
||||||
encourage the widest possible use of a certain library, so that it becomes
|
|
||||||
a de-facto standard. To achieve this, non-free programs must be
|
|
||||||
allowed to use the library. A more frequent case is that a free
|
|
||||||
library does the same job as widely used non-free libraries. In this
|
|
||||||
case, there is little to gain by limiting the free library to free
|
|
||||||
software only, so we use the Lesser General Public License.
|
|
||||||
|
|
||||||
In other cases, permission to use a particular library in non-free
|
|
||||||
programs enables a greater number of people to use a large body of
|
|
||||||
free software. For example, permission to use the GNU C Library in
|
|
||||||
non-free programs enables many more people to use the whole GNU
|
|
||||||
operating system, as well as its variant, the GNU/Linux operating
|
|
||||||
system.
|
|
||||||
|
|
||||||
Although the Lesser General Public License is Less protective of the
|
|
||||||
users' freedom, it does ensure that the user of a program that is
|
|
||||||
linked with the Library has the freedom and the wherewithal to run
|
|
||||||
that program using a modified version of the Library.
|
|
||||||
|
|
||||||
The precise terms and conditions for copying, distribution and
|
|
||||||
modification follow. Pay close attention to the difference between a
|
|
||||||
"work based on the library" and a "work that uses the library". The
|
|
||||||
former contains code derived from the library, whereas the latter must
|
|
||||||
be combined with the library in order to run.
|
|
||||||
|
|
||||||
GNU LESSER GENERAL PUBLIC LICENSE
|
|
||||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
|
||||||
|
|
||||||
0. This License Agreement applies to any software library or other
|
|
||||||
program which contains a notice placed by the copyright holder or
|
|
||||||
other authorized party saying it may be distributed under the terms of
|
|
||||||
this Lesser General Public License (also called "this License").
|
|
||||||
Each licensee is addressed as "you".
|
|
||||||
|
|
||||||
A "library" means a collection of software functions and/or data
|
|
||||||
prepared so as to be conveniently linked with application programs
|
|
||||||
(which use some of those functions and data) to form executables.
|
|
||||||
|
|
||||||
The "Library", below, refers to any such software library or work
|
|
||||||
which has been distributed under these terms. A "work based on the
|
|
||||||
Library" means either the Library or any derivative work under
|
|
||||||
copyright law: that is to say, a work containing the Library or a
|
|
||||||
portion of it, either verbatim or with modifications and/or translated
|
|
||||||
straightforwardly into another language. (Hereinafter, translation is
|
|
||||||
included without limitation in the term "modification".)
|
|
||||||
|
|
||||||
"Source code" for a work means the preferred form of the work for
|
|
||||||
making modifications to it. For a library, complete source code means
|
|
||||||
all the source code for all modules it contains, plus any associated
|
|
||||||
interface definition files, plus the scripts used to control compilation
|
|
||||||
and installation of the library.
|
|
||||||
|
|
||||||
Activities other than copying, distribution and modification are not
|
|
||||||
covered by this License they are outside its scope. The act of
|
|
||||||
running a program using the Library is not restricted, and output from
|
|
||||||
such a program is covered only if its contents constitute a work based
|
|
||||||
on the Library (independent of the use of the Library in a tool for
|
|
||||||
writing it). Whether that is true depends on what the Library does
|
|
||||||
and what the program that uses the Library does.
|
|
||||||
|
|
||||||
1. You may copy and distribute verbatim copies of the Library's
|
|
||||||
complete source code as you receive it, in any medium, provided that
|
|
||||||
you conspicuously and appropriately publish on each copy an
|
|
||||||
appropriate copyright notice and disclaimer of warranty keep intact
|
|
||||||
all the notices that refer to this License and to the absence of any
|
|
||||||
warranty and distribute a copy of this License along with the
|
|
||||||
Library.
|
|
||||||
|
|
||||||
You may charge a fee for the physical act of transferring a copy,
|
|
||||||
and you may at your option offer warranty protection in exchange for a
|
|
||||||
fee.
|
|
||||||
|
|
||||||
2. You may modify your copy or copies of the Library or any portion
|
|
||||||
of it, thus forming a work based on the Library, and copy and
|
|
||||||
distribute such modifications or work under the terms of Section 1
|
|
||||||
above, provided that you also meet all of these conditions:
|
|
||||||
|
|
||||||
a) The modified work must itself be a software library.
|
|
||||||
|
|
||||||
b) You must cause the files modified to carry prominent notices
|
|
||||||
stating that you changed the files and the date of any change.
|
|
||||||
|
|
||||||
c) You must cause the whole of the work to be licensed at no
|
|
||||||
charge to all third parties under the terms of this License.
|
|
||||||
|
|
||||||
d) If a facility in the modified Library refers to a function or a
|
|
||||||
table of data to be supplied by an application program that uses
|
|
||||||
the facility, other than as an argument passed when the facility
|
|
||||||
is invoked, then you must make a good faith effort to ensure that,
|
|
||||||
in the event an application does not supply such function or
|
|
||||||
table, the facility still operates, and performs whatever part of
|
|
||||||
its purpose remains meaningful.
|
|
||||||
|
|
||||||
(For example, a function in a library to compute square roots has
|
|
||||||
a purpose that is entirely well-defined independent of the
|
|
||||||
application. Therefore, Subsection 2d requires that any
|
|
||||||
application-supplied function or table used by this function must
|
|
||||||
be optional: if the application does not supply it, the square
|
|
||||||
root function must still compute square roots.)
|
|
||||||
|
|
||||||
These requirements apply to the modified work as a whole. If
|
|
||||||
identifiable sections of that work are not derived from the Library,
|
|
||||||
and can be reasonably considered independent and separate works in
|
|
||||||
themselves, then this License, and its terms, do not apply to those
|
|
||||||
sections when you distribute them as separate works. But when you
|
|
||||||
distribute the same sections as part of a whole which is a work based
|
|
||||||
on the Library, the distribution of the whole must be on the terms of
|
|
||||||
this License, whose permissions for other licensees extend to the
|
|
||||||
entire whole, and thus to each and every part regardless of who wrote
|
|
||||||
it.
|
|
||||||
|
|
||||||
Thus, it is not the intent of this section to claim rights or contest
|
|
||||||
your rights to work written entirely by you rather, the intent is to
|
|
||||||
exercise the right to control the distribution of derivative or
|
|
||||||
collective works based on the Library.
|
|
||||||
|
|
||||||
In addition, mere aggregation of another work not based on the Library
|
|
||||||
with the Library (or with a work based on the Library) on a volume of
|
|
||||||
a storage or distribution medium does not bring the other work under
|
|
||||||
the scope of this License.
|
|
||||||
|
|
||||||
3. You may opt to apply the terms of the ordinary GNU General Public
|
|
||||||
License instead of this License to a given copy of the Library. To do
|
|
||||||
this, you must alter all the notices that refer to this License, so
|
|
||||||
that they refer to the ordinary GNU General Public License, version 2,
|
|
||||||
instead of to this License. (If a newer version than version 2 of the
|
|
||||||
ordinary GNU General Public License has appeared, then you can specify
|
|
||||||
that version instead if you wish.) Do not make any other change in
|
|
||||||
these notices.
|
|
||||||
|
|
||||||
Once this change is made in a given copy, it is irreversible for
|
|
||||||
that copy, so the ordinary GNU General Public License applies to all
|
|
||||||
subsequent copies and derivative works made from that copy.
|
|
||||||
|
|
||||||
This option is useful when you wish to copy part of the code of
|
|
||||||
the Library into a program that is not a library.
|
|
||||||
|
|
||||||
4. You may copy and distribute the Library (or a portion or
|
|
||||||
derivative of it, under Section 2) in object code or executable form
|
|
||||||
under the terms of Sections 1 and 2 above provided that you accompany
|
|
||||||
it with the complete corresponding machine-readable source code, which
|
|
||||||
must be distributed under the terms of Sections 1 and 2 above on a
|
|
||||||
medium customarily used for software interchange.
|
|
||||||
|
|
||||||
If distribution of object code is made by offering access to copy
|
|
||||||
from a designated place, then offering equivalent access to copy the
|
|
||||||
source code from the same place satisfies the requirement to
|
|
||||||
distribute the source code, even though third parties are not
|
|
||||||
compelled to copy the source along with the object code.
|
|
||||||
|
|
||||||
5. A program that contains no derivative of any portion of the
|
|
||||||
Library, but is designed to work with the Library by being compiled or
|
|
||||||
linked with it, is called a "work that uses the Library". Such a
|
|
||||||
work, in isolation, is not a derivative work of the Library, and
|
|
||||||
therefore falls outside the scope of this License.
|
|
||||||
|
|
||||||
However, linking a "work that uses the Library" with the Library
|
|
||||||
creates an executable that is a derivative of the Library (because it
|
|
||||||
contains portions of the Library), rather than a "work that uses the
|
|
||||||
library". The executable is therefore covered by this License.
|
|
||||||
Section 6 states terms for distribution of such executables.
|
|
||||||
|
|
||||||
When a "work that uses the Library" uses material from a header file
|
|
||||||
that is part of the Library, the object code for the work may be a
|
|
||||||
derivative work of the Library even though the source code is not.
|
|
||||||
Whether this is true is especially significant if the work can be
|
|
||||||
linked without the Library, or if the work is itself a library. The
|
|
||||||
threshold for this to be true is not precisely defined by law.
|
|
||||||
|
|
||||||
If such an object file uses only numerical parameters, data
|
|
||||||
structure layouts and accessors, and small macros and small inline
|
|
||||||
functions (ten lines or less in length), then the use of the object
|
|
||||||
file is unrestricted, regardless of whether it is legally a derivative
|
|
||||||
work. (Executables containing this object code plus portions of the
|
|
||||||
Library will still fall under Section 6.)
|
|
||||||
|
|
||||||
Otherwise, if the work is a derivative of the Library, you may
|
|
||||||
distribute the object code for the work under the terms of Section 6.
|
|
||||||
Any executables containing that work also fall under Section 6,
|
|
||||||
whether or not they are linked directly with the Library itself.
|
|
||||||
|
|
||||||
6. As an exception to the Sections above, you may also combine or
|
|
||||||
link a "work that uses the Library" with the Library to produce a
|
|
||||||
work containing portions of the Library, and distribute that work
|
|
||||||
under terms of your choice, provided that the terms permit
|
|
||||||
modification of the work for the customer's own use and reverse
|
|
||||||
engineering for debugging such modifications.
|
|
||||||
|
|
||||||
You must give prominent notice with each copy of the work that the
|
|
||||||
Library is used in it and that the Library and its use are covered by
|
|
||||||
this License. You must supply a copy of this License. If the work
|
|
||||||
during execution displays copyright notices, you must include the
|
|
||||||
copyright notice for the Library among them, as well as a reference
|
|
||||||
directing the user to the copy of this License. Also, you must do one
|
|
||||||
of these things:
|
|
||||||
|
|
||||||
a) Accompany the work with the complete corresponding
|
|
||||||
machine-readable source code for the Library including whatever
|
|
||||||
changes were used in the work (which must be distributed under
|
|
||||||
Sections 1 and 2 above) and, if the work is an executable linked
|
|
||||||
with the Library, with the complete machine-readable "work that
|
|
||||||
uses the Library", as object code and/or source code, so that the
|
|
||||||
user can modify the Library and then relink to produce a modified
|
|
||||||
executable containing the modified Library. (It is understood
|
|
||||||
that the user who changes the contents of definitions files in the
|
|
||||||
Library will not necessarily be able to recompile the application
|
|
||||||
to use the modified definitions.)
|
|
||||||
|
|
||||||
b) Use a suitable shared library mechanism for linking with the
|
|
||||||
Library. A suitable mechanism is one that (1) uses at run time a
|
|
||||||
copy of the library already present on the user's computer system,
|
|
||||||
rather than copying library functions into the executable, and (2)
|
|
||||||
will operate properly with a modified version of the library, if
|
|
||||||
the user installs one, as long as the modified version is
|
|
||||||
interface-compatible with the version that the work was made with.
|
|
||||||
|
|
||||||
c) Accompany the work with a written offer, valid for at
|
|
||||||
least three years, to give the same user the materials
|
|
||||||
specified in Subsection 6a, above, for a charge no more
|
|
||||||
than the cost of performing this distribution.
|
|
||||||
|
|
||||||
d) If distribution of the work is made by offering access to copy
|
|
||||||
from a designated place, offer equivalent access to copy the above
|
|
||||||
specified materials from the same place.
|
|
||||||
|
|
||||||
e) Verify that the user has already received a copy of these
|
|
||||||
materials or that you have already sent this user a copy.
|
|
||||||
|
|
||||||
For an executable, the required form of the "work that uses the
|
|
||||||
Library" must include any data and utility programs needed for
|
|
||||||
reproducing the executable from it. However, as a special exception,
|
|
||||||
the materials to be distributed need not include anything that is
|
|
||||||
normally distributed (in either source or binary form) with the major
|
|
||||||
components (compiler, kernel, and so on) of the operating system on
|
|
||||||
which the executable runs, unless that component itself accompanies
|
|
||||||
the executable.
|
|
||||||
|
|
||||||
It may happen that this requirement contradicts the license
|
|
||||||
restrictions of other proprietary libraries that do not normally
|
|
||||||
accompany the operating system. Such a contradiction means you cannot
|
|
||||||
use both them and the Library together in an executable that you
|
|
||||||
distribute.
|
|
||||||
|
|
||||||
7. You may place library facilities that are a work based on the
|
|
||||||
Library side-by-side in a single library together with other library
|
|
||||||
facilities not covered by this License, and distribute such a combined
|
|
||||||
library, provided that the separate distribution of the work based on
|
|
||||||
the Library and of the other library facilities is otherwise
|
|
||||||
permitted, and provided that you do these two things:
|
|
||||||
|
|
||||||
a) Accompany the combined library with a copy of the same work
|
|
||||||
based on the Library, uncombined with any other library
|
|
||||||
facilities. This must be distributed under the terms of the
|
|
||||||
Sections above.
|
|
||||||
|
|
||||||
b) Give prominent notice with the combined library of the fact
|
|
||||||
that part of it is a work based on the Library, and explaining
|
|
||||||
where to find the accompanying uncombined form of the same work.
|
|
||||||
|
|
||||||
8. You may not copy, modify, sublicense, link with, or distribute
|
|
||||||
the Library except as expressly provided under this License. Any
|
|
||||||
attempt otherwise to copy, modify, sublicense, link with, or
|
|
||||||
distribute the Library is void, and will automatically terminate your
|
|
||||||
rights under this License. However, parties who have received copies,
|
|
||||||
or rights, from you under this License will not have their licenses
|
|
||||||
terminated so long as such parties remain in full compliance.
|
|
||||||
|
|
||||||
9. You are not required to accept this License, since you have not
|
|
||||||
signed it. However, nothing else grants you permission to modify or
|
|
||||||
distribute the Library or its derivative works. These actions are
|
|
||||||
prohibited by law if you do not accept this License. Therefore, by
|
|
||||||
modifying or distributing the Library (or any work based on the
|
|
||||||
Library), you indicate your acceptance of this License to do so, and
|
|
||||||
all its terms and conditions for copying, distributing or modifying
|
|
||||||
the Library or works based on it.
|
|
||||||
|
|
||||||
10. Each time you redistribute the Library (or any work based on the
|
|
||||||
Library), the recipient automatically receives a license from the
|
|
||||||
original licensor to copy, distribute, link with or modify the Library
|
|
||||||
subject to these terms and conditions. You may not impose any further
|
|
||||||
restrictions on the recipients' exercise of the rights granted herein.
|
|
||||||
You are not responsible for enforcing compliance by third parties with
|
|
||||||
this License.
|
|
||||||
|
|
||||||
11. If, as a consequence of a court judgment or allegation of patent
|
|
||||||
infringement or for any other reason (not limited to patent issues),
|
|
||||||
conditions are imposed on you (whether by court order, agreement or
|
|
||||||
otherwise) that contradict the conditions of this License, they do not
|
|
||||||
excuse you from the conditions of this License. If you cannot
|
|
||||||
distribute so as to satisfy simultaneously your obligations under this
|
|
||||||
License and any other pertinent obligations, then as a consequence you
|
|
||||||
may not distribute the Library at all. For example, if a patent
|
|
||||||
license would not permit royalty-free redistribution of the Library by
|
|
||||||
all those who receive copies directly or indirectly through you, then
|
|
||||||
the only way you could satisfy both it and this License would be to
|
|
||||||
refrain entirely from distribution of the Library.
|
|
||||||
|
|
||||||
If any portion of this section is held invalid or unenforceable under any
|
|
||||||
particular circumstance, the balance of the section is intended to apply,
|
|
||||||
and the section as a whole is intended to apply in other circumstances.
|
|
||||||
|
|
||||||
It is not the purpose of this section to induce you to infringe any
|
|
||||||
patents or other property right claims or to contest validity of any
|
|
||||||
such claims this section has the sole purpose of protecting the
|
|
||||||
integrity of the free software distribution system which is
|
|
||||||
implemented by public license practices. Many people have made
|
|
||||||
generous contributions to the wide range of software distributed
|
|
||||||
through that system in reliance on consistent application of that
|
|
||||||
system it is up to the author/donor to decide if he or she is willing
|
|
||||||
to distribute software through any other system and a licensee cannot
|
|
||||||
impose that choice.
|
|
||||||
|
|
||||||
This section is intended to make thoroughly clear what is believed to
|
|
||||||
be a consequence of the rest of this License.
|
|
||||||
|
|
||||||
12. If the distribution and/or use of the Library is restricted in
|
|
||||||
certain countries either by patents or by copyrighted interfaces, the
|
|
||||||
original copyright holder who places the Library under this License may add
|
|
||||||
an explicit geographical distribution limitation excluding those countries,
|
|
||||||
so that distribution is permitted only in or among countries not thus
|
|
||||||
excluded. In such case, this License incorporates the limitation as if
|
|
||||||
written in the body of this License.
|
|
||||||
|
|
||||||
13. The Free Software Foundation may publish revised and/or new
|
|
||||||
versions of the Lesser General Public License from time to time.
|
|
||||||
Such new versions will be similar in spirit to the present version,
|
|
||||||
but may differ in detail to address new problems or concerns.
|
|
||||||
|
|
||||||
Each version is given a distinguishing version number. If the Library
|
|
||||||
specifies a version number of this License which applies to it and
|
|
||||||
"any later version", you have the option of following the terms and
|
|
||||||
conditions either of that version or of any later version published by
|
|
||||||
the Free Software Foundation. If the Library does not specify a
|
|
||||||
license version number, you may choose any version ever published by
|
|
||||||
the Free Software Foundation.
|
|
||||||
|
|
||||||
14. If you wish to incorporate parts of the Library into other free
|
|
||||||
programs whose distribution conditions are incompatible with these,
|
|
||||||
write to the author to ask for permission. For software which is
|
|
||||||
copyrighted by the Free Software Foundation, write to the Free
|
|
||||||
Software Foundation we sometimes make exceptions for this. Our
|
|
||||||
decision will be guided by the two goals of preserving the free status
|
|
||||||
of all derivatives of our free software and of promoting the sharing
|
|
||||||
and reuse of software generally.
|
|
||||||
|
|
||||||
NO WARRANTY
|
|
||||||
|
|
||||||
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
|
|
||||||
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
|
|
||||||
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
|
|
||||||
OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
|
|
||||||
KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
|
|
||||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
|
||||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
|
|
||||||
LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
|
|
||||||
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
|
||||||
|
|
||||||
16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
|
|
||||||
WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
|
|
||||||
AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
|
|
||||||
FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
|
|
||||||
CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
|
|
||||||
LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
|
|
||||||
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
|
|
||||||
FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
|
|
||||||
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
|
|
||||||
DAMAGES.
|
|
||||||
|
|
||||||
END OF TERMS AND CONDITIONS
|
|
||||||
|
|
||||||
How to Apply These Terms to Your New Libraries
|
|
||||||
|
|
||||||
If you develop a new library, and you want it to be of the greatest
|
|
||||||
possible use to the public, we recommend making it free software that
|
|
||||||
everyone can redistribute and change. You can do so by permitting
|
|
||||||
redistribution under these terms (or, alternatively, under the terms of the
|
|
||||||
ordinary General Public License).
|
|
||||||
|
|
||||||
To apply these terms, attach the following notices to the library. It is
|
|
||||||
safest to attach them to the start of each source file to most effectively
|
|
||||||
convey the exclusion of warranty and each file should have at least the
|
|
||||||
"copyright" line and a pointer to where the full notice is found.
|
|
||||||
|
|
||||||
<one line to give the library's name and a brief idea of what it does.>
|
|
||||||
Copyright (C) <year> <name of author>
|
|
||||||
|
|
||||||
This library is free software you can redistribute it and/or
|
|
||||||
modify it under the terms of the GNU Lesser General Public
|
|
||||||
License as published by the Free Software Foundation either
|
|
||||||
version 2.1 of the License, or (at your option) any later version.
|
|
||||||
|
|
||||||
This library is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
Lesser General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public
|
|
||||||
License along with this library if not, write to the Free Software
|
|
||||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
||||||
|
|
||||||
Also add information on how to contact you by electronic and paper mail.
|
|
||||||
|
|
||||||
You should also get your employer (if you work as a programmer) or your
|
|
||||||
school, if any, to sign a "copyright disclaimer" for the library, if
|
|
||||||
necessary. Here is a sample alter the names:
|
|
||||||
|
|
||||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the
|
|
||||||
library `Frob' (a library for tweaking knobs) written by James Random Hacker.
|
|
||||||
|
|
||||||
<signature of Ty Coon>, 1 April 1990
|
|
||||||
Ty Coon, President of Vice
|
|
||||||
|
|
||||||
That's all there is to it!
|
|
||||||
|
|
||||||
|
|
||||||
```
|
|
||||||
-------------------------------------------------------------------------------
|
|
BIN
ml_lme/vendor/LeapSDK/lib/x64/LeapC.dll
vendored
BIN
ml_lme/vendor/LeapSDK/lib/x64/LeapC.dll
vendored
Binary file not shown.
|
@ -48,6 +48,9 @@ namespace ml_pam
|
||||||
HandState m_leftHandState = HandState.Empty;
|
HandState m_leftHandState = HandState.Empty;
|
||||||
HandState m_rightHandState = HandState.Empty;
|
HandState m_rightHandState = HandState.Empty;
|
||||||
|
|
||||||
|
AvatarBoolParameter m_leftHandParameter = null;
|
||||||
|
AvatarBoolParameter m_rightHandParameter = null;
|
||||||
|
|
||||||
// Unity events
|
// Unity events
|
||||||
void Start()
|
void Start()
|
||||||
{
|
{
|
||||||
|
@ -239,7 +242,7 @@ namespace ml_pam
|
||||||
{
|
{
|
||||||
m_enabled = p_state;
|
m_enabled = p_state;
|
||||||
|
|
||||||
if(m_enabled)
|
if(p_state)
|
||||||
{
|
{
|
||||||
if(m_leftHandState != HandState.Empty)
|
if(m_leftHandState != HandState.Empty)
|
||||||
SetArmActive(Settings.LeadHand.Left, true);
|
SetArmActive(Settings.LeadHand.Left, true);
|
||||||
|
@ -335,6 +338,8 @@ namespace ml_pam
|
||||||
m_armIKLeft = null;
|
m_armIKLeft = null;
|
||||||
m_armIKRight = null;
|
m_armIKRight = null;
|
||||||
m_armLength = 0f;
|
m_armLength = 0f;
|
||||||
|
m_leftHandParameter = null;
|
||||||
|
m_rightHandParameter = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnAvatarSetup()
|
void OnAvatarSetup()
|
||||||
|
@ -365,6 +370,9 @@ namespace ml_pam
|
||||||
SetupArmIK();
|
SetupArmIK();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m_leftHandParameter = new AvatarBoolParameter("LeftHandExtended", PlayerSetup.Instance.animatorManager);
|
||||||
|
m_rightHandParameter = new AvatarBoolParameter("RightHandExtended", PlayerSetup.Instance.animatorManager);
|
||||||
|
|
||||||
OnEnabledChanged(m_enabled);
|
OnEnabledChanged(m_enabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -533,6 +541,11 @@ namespace ml_pam
|
||||||
m_armIKRight.solver.IKPositionWeight = (p_state ? 1f : 0f);
|
m_armIKRight.solver.IKPositionWeight = (p_state ? 1f : 0f);
|
||||||
m_armIKRight.solver.IKRotationWeight = (p_state ? 1f : 0f);
|
m_armIKRight.solver.IKRotationWeight = (p_state ? 1f : 0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if((p_hand == Settings.LeadHand.Left) || (p_hand == Settings.LeadHand.Both))
|
||||||
|
m_leftHandParameter?.SetValue(p_state);
|
||||||
|
if((p_hand == Settings.LeadHand.Right) || (p_hand == Settings.LeadHand.Both))
|
||||||
|
m_rightHandParameter?.SetValue(p_state);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
43
ml_pam/AvatarBoolParameter.cs
Normal file
43
ml_pam/AvatarBoolParameter.cs
Normal file
|
@ -0,0 +1,43 @@
|
||||||
|
using ABI_RC.Core.Util.AnimatorManager;
|
||||||
|
using System.Text.RegularExpressions;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace ml_pam
|
||||||
|
{
|
||||||
|
class AvatarBoolParameter
|
||||||
|
{
|
||||||
|
public readonly string m_name;
|
||||||
|
public readonly int m_hash = 0;
|
||||||
|
public readonly bool m_sync;
|
||||||
|
readonly AvatarAnimatorManager m_manager = null;
|
||||||
|
|
||||||
|
public AvatarBoolParameter(string p_name, AvatarAnimatorManager p_manager)
|
||||||
|
{
|
||||||
|
m_name = p_name;
|
||||||
|
m_manager = p_manager;
|
||||||
|
|
||||||
|
Regex l_regex = new Regex("^#?" + p_name + '$');
|
||||||
|
foreach(var l_param in m_manager.Animator.parameters)
|
||||||
|
{
|
||||||
|
if(l_regex.IsMatch(l_param.name) && (l_param.type == AnimatorControllerParameterType.Bool))
|
||||||
|
{
|
||||||
|
m_name = l_param.name;
|
||||||
|
m_sync = !l_param.name.StartsWith('#');
|
||||||
|
m_hash = l_param.nameHash;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetValue(bool p_value)
|
||||||
|
{
|
||||||
|
if(m_hash != 0)
|
||||||
|
{
|
||||||
|
if(m_sync)
|
||||||
|
m_manager.SetParameter(m_name, p_value);
|
||||||
|
else
|
||||||
|
m_manager.Animator.SetBool(m_hash, p_value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,4 +1,4 @@
|
||||||
[assembly: MelonLoader.MelonInfo(typeof(ml_pam.PickupArmMovement), "PickupArmMovement", "1.1.3", "SDraw", "https://github.com/SDraw/ml_mods_cvr")]
|
[assembly: MelonLoader.MelonInfo(typeof(ml_pam.PickupArmMovement), "PickupArmMovement", "1.1.4", "SDraw", "https://github.com/SDraw/ml_mods_cvr")]
|
||||||
[assembly: MelonLoader.MelonGame(null, "ChilloutVR")]
|
[assembly: MelonLoader.MelonGame(null, "ChilloutVR")]
|
||||||
[assembly: MelonLoader.MelonPriority(1)]
|
[assembly: MelonLoader.MelonPriority(1)]
|
||||||
[assembly: MelonLoader.MelonPlatform(MelonLoader.MelonPlatformAttribute.CompatiblePlatforms.WINDOWS_X64)]
|
[assembly: MelonLoader.MelonPlatform(MelonLoader.MelonPlatformAttribute.CompatiblePlatforms.WINDOWS_X64)]
|
||||||
|
|
|
@ -13,6 +13,9 @@ Available mod's settings in `Settings - Interactions - Pickup Arm Movement`:
|
||||||
* **Leading hand:** hand that will be extended when gragging pickup; available values: `Left`, `Right`, `Both`; default value - `Right`.
|
* **Leading hand:** hand that will be extended when gragging pickup; available values: `Left`, `Right`, `Both`; default value - `Right`.
|
||||||
* **Hands extension (Q\E):** extend left and right hand if `Q` and `E` keys are pressed; default value - `true`.
|
* **Hands extension (Q\E):** extend left and right hand if `Q` and `E` keys are pressed; default value - `true`.
|
||||||
|
|
||||||
|
Available animator boolean parameters:
|
||||||
|
* **LeftHandExtended:`` indicates if left hand is extended.
|
||||||
|
* **RightHandExtended:`` indicates if right hand is extended.
|
||||||
|
|
||||||
# Notes
|
# Notes
|
||||||
* Made for desktop mode in mind.
|
* Made for desktop mode in mind.
|
||||||
* Compatible with [DekstopVRIK](https://github.com/NotAKidOnSteam/NAK_CVR_Mods).
|
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
<TargetFramework>netstandard2.1</TargetFramework>
|
<TargetFramework>netstandard2.1</TargetFramework>
|
||||||
<Platforms>x64</Platforms>
|
<Platforms>x64</Platforms>
|
||||||
<PackageId>PickupArmMovement</PackageId>
|
<PackageId>PickupArmMovement</PackageId>
|
||||||
<Version>1.1.3</Version>
|
<Version>1.1.4</Version>
|
||||||
<Authors>SDraw</Authors>
|
<Authors>SDraw</Authors>
|
||||||
<Company>None</Company>
|
<Company>None</Company>
|
||||||
<Product>PickupArmMovement</Product>
|
<Product>PickupArmMovement</Product>
|
||||||
|
|
|
@ -41,11 +41,16 @@ namespace ml_pmc
|
||||||
HumanPose m_pose;
|
HumanPose m_pose;
|
||||||
PuppetParser m_puppetParser = null;
|
PuppetParser m_puppetParser = null;
|
||||||
|
|
||||||
|
void Awake()
|
||||||
|
{
|
||||||
|
if((Instance != null) && (Instance != this))
|
||||||
|
Object.Destroy(this);
|
||||||
|
else
|
||||||
|
Instance = this;
|
||||||
|
}
|
||||||
|
|
||||||
void Start()
|
void Start()
|
||||||
{
|
{
|
||||||
if(Instance == null)
|
|
||||||
Instance = this;
|
|
||||||
|
|
||||||
GameEvents.OnAvatarClear.AddHandler(this.OnAvatarClear);
|
GameEvents.OnAvatarClear.AddHandler(this.OnAvatarClear);
|
||||||
GameEvents.OnAvatarSetup.AddHandler(this.OnAvatarSetup);
|
GameEvents.OnAvatarSetup.AddHandler(this.OnAvatarSetup);
|
||||||
GameEvents.OnAvatarPreReuse.AddHandler(this.OnAvatarPreReuse);
|
GameEvents.OnAvatarPreReuse.AddHandler(this.OnAvatarPreReuse);
|
||||||
|
|
|
@ -1,29 +0,0 @@
|
||||||
using ABI.CCK.Components;
|
|
||||||
using ABI_RC.Systems.Movement;
|
|
||||||
using UnityEngine;
|
|
||||||
|
|
||||||
namespace ml_prm
|
|
||||||
{
|
|
||||||
[DisallowMultipleComponent]
|
|
||||||
class GravityInfluencer : MonoBehaviour
|
|
||||||
{
|
|
||||||
Rigidbody m_rigidBody = null;
|
|
||||||
PhysicsInfluencer m_physicsInfluencer = null;
|
|
||||||
bool m_activeGravity = true;
|
|
||||||
|
|
||||||
void Start()
|
|
||||||
{
|
|
||||||
m_rigidBody = this.GetComponent<Rigidbody>();
|
|
||||||
m_physicsInfluencer = this.GetComponent<PhysicsInfluencer>();
|
|
||||||
}
|
|
||||||
|
|
||||||
void FixedUpdate()
|
|
||||||
{
|
|
||||||
m_rigidBody.useGravity = false;
|
|
||||||
if(m_activeGravity && ((m_physicsInfluencer == null) || !m_physicsInfluencer.enableInfluence || !m_physicsInfluencer.GetSubmerged()))
|
|
||||||
m_rigidBody.AddForce(BetterBetterCharacterController.Instance.GravityResult.AppliedGravity * m_rigidBody.mass);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void SetActiveGravity(bool p_state) => m_activeGravity = p_state;
|
|
||||||
}
|
|
||||||
}
|
|
215
ml_prm/ModUi.cs
215
ml_prm/ModUi.cs
|
@ -1,8 +1,8 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
|
using BTKUILib.UIObjects;
|
||||||
|
using BTKUILib.UIObjects.Components;
|
||||||
|
|
||||||
namespace ml_prm
|
namespace ml_prm
|
||||||
{
|
{
|
||||||
|
@ -37,83 +37,103 @@ namespace ml_prm
|
||||||
FallLimit
|
FallLimit
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const string c_ragdollKeyTooltip = "Switch ragdoll mode with '{0}' key";
|
||||||
|
const string c_fallLimitTooltip = "Fall limit based on impact velocity<p>Current value corresponds to drop from {0} units with default gravity</p>";
|
||||||
|
|
||||||
internal static readonly UiEvent OnSwitchChanged = new UiEvent();
|
internal static readonly UiEvent OnSwitchChanged = new UiEvent();
|
||||||
|
|
||||||
static List<object> ms_uiElements = null;
|
static Page ms_page = null;
|
||||||
|
static Category ms_category = null;
|
||||||
|
|
||||||
|
static Button ms_ragdollButton = null;
|
||||||
|
static ToggleButton ms_hotkeyToggle = null;
|
||||||
|
static ToggleButton ms_gravityToggle = null;
|
||||||
|
static ToggleButton ms_pointersToggle = null;
|
||||||
|
static ToggleButton ms_ignoreLocalToggle = null;
|
||||||
|
static ToggleButton ms_combatToggle = null;
|
||||||
|
static ToggleButton ms_recoveryToggle = null;
|
||||||
|
static ToggleButton ms_slipperinessToggle = null;
|
||||||
|
static ToggleButton ms_bouncinessToggle = null;
|
||||||
|
static ToggleButton ms_viewDirectionToggle = null;
|
||||||
|
static ToggleButton ms_jumpRecoverToggle = null;
|
||||||
|
static ToggleButton ms_buoyancyToggle = null;
|
||||||
|
static ToggleButton ms_fallDamageToggle = null;
|
||||||
|
static SliderFloat ms_velocityMultiplierSlider = null;
|
||||||
|
static SliderFloat ms_movementDragSlider = null;
|
||||||
|
static SliderFloat ms_angularMovementDragSlider = null;
|
||||||
|
static SliderFloat ms_recoverDelaySlider = null;
|
||||||
|
static SliderFloat ms_fallLimitSlider = null;
|
||||||
|
static Button ms_resetButton = null;
|
||||||
|
|
||||||
internal static void Init()
|
internal static void Init()
|
||||||
{
|
|
||||||
ms_uiElements = new List<object>();
|
|
||||||
|
|
||||||
if(MelonLoader.MelonMod.RegisteredMelons.FirstOrDefault(m => m.Info.Name == "BTKUILib") != null)
|
|
||||||
CreateUi();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Separated method, otherwise exception is thrown, funny CSharp and optional references, smh
|
|
||||||
static void CreateUi()
|
|
||||||
{
|
{
|
||||||
BTKUILib.QuickMenuAPI.PrepareIcon("PlayerRagdollMod", "PRM-Person", GetIconStream("person.png"));
|
BTKUILib.QuickMenuAPI.PrepareIcon("PlayerRagdollMod", "PRM-Person", GetIconStream("person.png"));
|
||||||
|
|
||||||
var l_modRoot = new BTKUILib.UIObjects.Page("PlayerRagdollMod", "MainPage", true, "PRM-Person");
|
ms_page = new Page("PlayerRagdollMod", "MainPage", true, "PRM-Person");
|
||||||
l_modRoot.MenuTitle = "Player Ragdoll Mod";
|
ms_page.MenuTitle = "Player Ragdoll Mod";
|
||||||
l_modRoot.MenuSubtitle = "Become a ragdoll and change various settings for people amusement";
|
ms_page.MenuSubtitle = "Become a ragdoll and change various settings for people amusement";
|
||||||
|
|
||||||
var l_modCategory = l_modRoot.AddCategory("Settings");
|
ms_category = ms_page.AddCategory("Settings");
|
||||||
|
|
||||||
l_modCategory.AddButton("Switch ragdoll", "PRM-Person", "Switch between normal and ragdoll state.").OnPress += OnSwitch;
|
ms_ragdollButton = ms_category.AddButton("Switch ragdoll", "PRM-Person", "Switch between normal and ragdoll state");
|
||||||
|
ms_ragdollButton.OnPress += OnSwitch;
|
||||||
|
|
||||||
ms_uiElements.Add(l_modCategory.AddToggle("Use hotkey", "Switch ragdoll mode with 'R' key", Settings.Hotkey));
|
ms_hotkeyToggle = ms_category.AddToggle("Use hotkey", "Switch ragdoll mode with 'R' key", Settings.Hotkey);
|
||||||
(ms_uiElements[(int)UiIndex.Hotkey] as BTKUILib.UIObjects.Components.ToggleButton).OnValueUpdated += (state) => OnToggleUpdate(UiIndex.Hotkey, state);
|
ms_hotkeyToggle.ToggleTooltip = string.Format(c_ragdollKeyTooltip, Settings.HotkeyKey);
|
||||||
|
ms_hotkeyToggle.OnValueUpdated += (state) => OnToggleUpdate(UiIndex.Hotkey, state);
|
||||||
|
Settings.OnHotkeyKeyChanged.AddHandler(OnHotkeyKeyChanged);
|
||||||
|
|
||||||
ms_uiElements.Add(l_modCategory.AddToggle("Use gravity", "Apply gravity to ragdoll", Settings.Gravity));
|
ms_gravityToggle = ms_category.AddToggle("Use gravity", "Apply gravity to ragdoll", Settings.Gravity);
|
||||||
(ms_uiElements[(int)UiIndex.Gravity] as BTKUILib.UIObjects.Components.ToggleButton).OnValueUpdated += (state) => OnToggleUpdate(UiIndex.Gravity, state);
|
ms_gravityToggle.OnValueUpdated += (state) => OnToggleUpdate(UiIndex.Gravity, state);
|
||||||
|
|
||||||
ms_uiElements.Add(l_modCategory.AddToggle("Pointers reaction", "React to trigger colliders with CVRPointer component of 'ragdoll' type", Settings.PointersReaction));
|
ms_pointersToggle = ms_category.AddToggle("Pointers reaction", "React to trigger colliders with CVRPointer component of 'ragdoll' type", Settings.PointersReaction);
|
||||||
(ms_uiElements[(int)UiIndex.PointersReaction] as BTKUILib.UIObjects.Components.ToggleButton).OnValueUpdated += (state) => OnToggleUpdate(UiIndex.PointersReaction, state);
|
ms_pointersToggle.OnValueUpdated += (state) => OnToggleUpdate(UiIndex.PointersReaction, state);
|
||||||
|
|
||||||
ms_uiElements.Add(l_modCategory.AddToggle("Ignore local pointers", "Ignore local avatar's CVRPointer components of 'ragdoll' type", Settings.IgnoreLocal));
|
ms_ignoreLocalToggle = ms_category.AddToggle("Ignore local pointers", "Ignore local avatar's CVRPointer components of 'ragdoll' type", Settings.IgnoreLocal);
|
||||||
(ms_uiElements[(int)UiIndex.IgnoreLocal] as BTKUILib.UIObjects.Components.ToggleButton).OnValueUpdated += (state) => OnToggleUpdate(UiIndex.IgnoreLocal, state);
|
ms_ignoreLocalToggle.OnValueUpdated += (state) => OnToggleUpdate(UiIndex.IgnoreLocal, state);
|
||||||
|
|
||||||
ms_uiElements.Add(l_modCategory.AddToggle("Combat reaction", "Ragdoll upon combat system death", Settings.CombatReaction));
|
ms_combatToggle = ms_category.AddToggle("Combat reaction", "Ragdoll upon combat system death", Settings.CombatReaction);
|
||||||
(ms_uiElements[(int)UiIndex.CombatReaction] as BTKUILib.UIObjects.Components.ToggleButton).OnValueUpdated += (state) => OnToggleUpdate(UiIndex.CombatReaction, state);
|
ms_combatToggle.OnValueUpdated += (state) => OnToggleUpdate(UiIndex.CombatReaction, state);
|
||||||
|
|
||||||
ms_uiElements.Add(l_modCategory.AddToggle("Auto recover", "Automatically unragdoll after set recover delay", Settings.AutoRecover));
|
ms_recoveryToggle = ms_category.AddToggle("Auto recover", "Automatically unragdoll after set recover delay", Settings.AutoRecover);
|
||||||
(ms_uiElements[(int)UiIndex.AutoRecover] as BTKUILib.UIObjects.Components.ToggleButton).OnValueUpdated += (state) => OnToggleUpdate(UiIndex.AutoRecover, state);
|
ms_recoveryToggle.OnValueUpdated += (state) => OnToggleUpdate(UiIndex.AutoRecover, state);
|
||||||
|
|
||||||
ms_uiElements.Add(l_modCategory.AddToggle("Slipperiness", "Enables/disables friction of ragdoll", Settings.Slipperiness));
|
ms_slipperinessToggle = ms_category.AddToggle("Slipperiness", "Enables/disables friction of ragdoll", Settings.Slipperiness);
|
||||||
(ms_uiElements[(int)UiIndex.Slipperiness] as BTKUILib.UIObjects.Components.ToggleButton).OnValueUpdated += (state) => OnToggleUpdate(UiIndex.Slipperiness, state);
|
ms_slipperinessToggle.OnValueUpdated += (state) => OnToggleUpdate(UiIndex.Slipperiness, state);
|
||||||
|
|
||||||
ms_uiElements.Add(l_modCategory.AddToggle("Bounciness", "Enables/disables bounciness of ragdoll", Settings.Bounciness));
|
ms_bouncinessToggle = ms_category.AddToggle("Bounciness", "Enables/disables bounciness of ragdoll", Settings.Bounciness);
|
||||||
(ms_uiElements[(int)UiIndex.Bounciness] as BTKUILib.UIObjects.Components.ToggleButton).OnValueUpdated += (state) => OnToggleUpdate(UiIndex.Bounciness, state);
|
ms_bouncinessToggle.OnValueUpdated += (state) => OnToggleUpdate(UiIndex.Bounciness, state);
|
||||||
|
|
||||||
ms_uiElements.Add(l_modCategory.AddToggle("View direction velocity", "Apply velocity to camera view direction", Settings.ViewVelocity));
|
ms_viewDirectionToggle = ms_category.AddToggle("View direction velocity", "Apply velocity to camera view direction", Settings.ViewVelocity);
|
||||||
(ms_uiElements[(int)UiIndex.ViewVelocity] as BTKUILib.UIObjects.Components.ToggleButton).OnValueUpdated += (state) => OnToggleUpdate(UiIndex.ViewVelocity, state);
|
ms_viewDirectionToggle.OnValueUpdated += (state) => OnToggleUpdate(UiIndex.ViewVelocity, state);
|
||||||
|
|
||||||
ms_uiElements.Add(l_modCategory.AddToggle("Jump recover", "Recover from ragdoll state by jumping", Settings.JumpRecover));
|
ms_jumpRecoverToggle = ms_category.AddToggle("Jump recover", "Recover from ragdoll state by jumping", Settings.JumpRecover);
|
||||||
(ms_uiElements[(int)UiIndex.JumpRecover] as BTKUILib.UIObjects.Components.ToggleButton).OnValueUpdated += (state) => OnToggleUpdate(UiIndex.JumpRecover, state);
|
ms_jumpRecoverToggle.OnValueUpdated += (state) => OnToggleUpdate(UiIndex.JumpRecover, state);
|
||||||
|
|
||||||
ms_uiElements.Add(l_modCategory.AddToggle("Buoyancy", "Enable buoyancy in fluid volumes. Warning: constantly changes movement and air drag of hips, spine and chest.", Settings.Buoyancy));
|
ms_buoyancyToggle = ms_category.AddToggle("Buoyancy", "Enable buoyancy in fluid volumes<p>Warning: constantly changes movement and air drag of hips, spine and chest</p>", Settings.Buoyancy);
|
||||||
(ms_uiElements[(int)UiIndex.Buoyancy] as BTKUILib.UIObjects.Components.ToggleButton).OnValueUpdated += (state) => OnToggleUpdate(UiIndex.Buoyancy, state);
|
ms_buoyancyToggle.OnValueUpdated += (state) => OnToggleUpdate(UiIndex.Buoyancy, state);
|
||||||
|
|
||||||
ms_uiElements.Add(l_modCategory.AddToggle("Fall damage", "Enable ragdoll when falling from height", Settings.FallDamage));
|
ms_fallDamageToggle = ms_category.AddToggle("Fall damage", "Enable ragdoll when falling from height", Settings.FallDamage);
|
||||||
(ms_uiElements[(int)UiIndex.FallDamage] as BTKUILib.UIObjects.Components.ToggleButton).OnValueUpdated += (state) => OnToggleUpdate(UiIndex.FallDamage, state);
|
ms_fallDamageToggle.OnValueUpdated += (state) => OnToggleUpdate(UiIndex.FallDamage, state);
|
||||||
|
|
||||||
ms_uiElements.Add(l_modCategory.AddSlider("Velocity multiplier", "Velocity multiplier upon entering ragdoll state", Settings.VelocityMultiplier, 1f, 50f));
|
ms_velocityMultiplierSlider = ms_category.AddSlider("Velocity multiplier", "Velocity multiplier upon entering ragdoll state", Settings.VelocityMultiplier, 1f, 50f);
|
||||||
(ms_uiElements[(int)UiIndex.VelocityMultiplier] as BTKUILib.UIObjects.Components.SliderFloat).OnValueUpdated += (value) => OnSliderUpdate(UiIndex.VelocityMultiplier, value);
|
ms_velocityMultiplierSlider.OnValueUpdated += (value) => OnSliderUpdate(UiIndex.VelocityMultiplier, value);
|
||||||
|
|
||||||
ms_uiElements.Add(l_modCategory.AddSlider("Movement drag", "Movement resistance", Settings.MovementDrag, 0f, 50f));
|
ms_movementDragSlider = ms_category.AddSlider("Movement drag", "Movement resistance", Settings.MovementDrag, 0f, 50f);
|
||||||
(ms_uiElements[(int)UiIndex.MovementDrag] as BTKUILib.UIObjects.Components.SliderFloat).OnValueUpdated += (value) => OnSliderUpdate(UiIndex.MovementDrag, value);
|
ms_movementDragSlider.OnValueUpdated += (value) => OnSliderUpdate(UiIndex.MovementDrag, value);
|
||||||
|
|
||||||
ms_uiElements.Add(l_modCategory.AddSlider("Angular movement drag", "Rotation movement resistance", Settings.AngularDrag, 0f, 50f));
|
ms_angularMovementDragSlider = ms_category.AddSlider("Angular movement drag", "Rotation movement resistance", Settings.AngularDrag, 0f, 50f);
|
||||||
(ms_uiElements[(int)UiIndex.AngularDrag] as BTKUILib.UIObjects.Components.SliderFloat).OnValueUpdated += (value) => OnSliderUpdate(UiIndex.AngularDrag, value);
|
ms_angularMovementDragSlider.OnValueUpdated += (value) => OnSliderUpdate(UiIndex.AngularDrag, value);
|
||||||
|
|
||||||
ms_uiElements.Add(l_modCategory.AddSlider("Recover delay (seconds)", "Recover delay for automatic recover", Settings.RecoverDelay, 1f, 10f));
|
ms_recoverDelaySlider = ms_category.AddSlider("Recover delay (seconds)", "Recover delay for automatic recover", Settings.RecoverDelay, 1f, 10f);
|
||||||
(ms_uiElements[(int)UiIndex.RecoverDelay] as BTKUILib.UIObjects.Components.SliderFloat).OnValueUpdated += (value) => OnSliderUpdate(UiIndex.RecoverDelay, value);
|
ms_recoverDelaySlider.OnValueUpdated += (value) => OnSliderUpdate(UiIndex.RecoverDelay, value);
|
||||||
|
|
||||||
ms_uiElements.Add(l_modCategory.AddSlider("Fall limit", "Height limit for fall damage", Settings.FallLimit, 0f, 100f));
|
ms_fallLimitSlider = ms_category.AddSlider("Fall limit", "", Settings.FallLimit, 4.5f, 44.5f);
|
||||||
(ms_uiElements[(int)UiIndex.FallLimit] as BTKUILib.UIObjects.Components.SliderFloat).OnValueUpdated += (value) => OnSliderUpdate(UiIndex.FallLimit, value);
|
ms_fallLimitSlider.SliderTooltip = string.Format(c_fallLimitTooltip, GetDropHeight(Settings.FallLimit));
|
||||||
|
ms_fallLimitSlider.OnValueUpdated += (value) => OnSliderUpdate(UiIndex.FallLimit, value);
|
||||||
|
|
||||||
l_modCategory.AddButton("Reset settings", "", "Reset mod settings to default").OnPress += Reset;
|
ms_resetButton = ms_category.AddButton("Reset settings", "", "Reset mod settings to default");
|
||||||
|
ms_resetButton.OnPress += Reset;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void OnSwitch()
|
static void OnSwitch()
|
||||||
|
@ -128,7 +148,7 @@ namespace ml_prm
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void OnToggleUpdate(UiIndex p_index, bool p_state, bool p_force = false)
|
static void OnToggleUpdate(UiIndex p_index, bool p_state)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -182,9 +202,6 @@ namespace ml_prm
|
||||||
Settings.SetSetting(Settings.ModSetting.FallDamage, p_state);
|
Settings.SetSetting(Settings.ModSetting.FallDamage, p_state);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(p_force)
|
|
||||||
(ms_uiElements[(int)p_index] as BTKUILib.UIObjects.Components.ToggleButton).ToggleValue = p_state;
|
|
||||||
}
|
}
|
||||||
catch(Exception e)
|
catch(Exception e)
|
||||||
{
|
{
|
||||||
|
@ -192,7 +209,7 @@ namespace ml_prm
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void OnSliderUpdate(UiIndex p_index, float p_value, bool p_force = false)
|
static void OnSliderUpdate(UiIndex p_index, float p_value)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -215,12 +232,12 @@ namespace ml_prm
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case UiIndex.FallLimit:
|
case UiIndex.FallLimit:
|
||||||
|
{
|
||||||
Settings.SetSetting(Settings.ModSetting.FallLimit, p_value);
|
Settings.SetSetting(Settings.ModSetting.FallLimit, p_value);
|
||||||
|
ms_fallLimitSlider.SliderTooltip = string.Format(c_fallLimitTooltip, GetDropHeight(p_value));
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(p_force)
|
|
||||||
(ms_uiElements[(int)p_index] as BTKUILib.UIObjects.Components.SliderFloat).SetSliderValue(p_value);
|
|
||||||
}
|
}
|
||||||
catch(Exception e)
|
catch(Exception e)
|
||||||
{
|
{
|
||||||
|
@ -230,23 +247,62 @@ namespace ml_prm
|
||||||
|
|
||||||
static void Reset()
|
static void Reset()
|
||||||
{
|
{
|
||||||
OnToggleUpdate(UiIndex.Hotkey, true, true);
|
OnToggleUpdate(UiIndex.Hotkey, true);
|
||||||
OnToggleUpdate(UiIndex.Gravity, true, true);
|
ms_hotkeyToggle.ToggleValue = true;
|
||||||
OnToggleUpdate(UiIndex.PointersReaction, true, true);
|
|
||||||
OnToggleUpdate(UiIndex.IgnoreLocal, true, true);
|
OnToggleUpdate(UiIndex.Gravity, true);
|
||||||
OnToggleUpdate(UiIndex.CombatReaction, true, true);
|
ms_gravityToggle.ToggleValue = true;
|
||||||
OnToggleUpdate(UiIndex.AutoRecover, false, true);
|
|
||||||
OnToggleUpdate(UiIndex.Slipperiness, false, true);
|
OnToggleUpdate(UiIndex.PointersReaction, true);
|
||||||
OnToggleUpdate(UiIndex.Bounciness, false, true);
|
ms_pointersToggle.ToggleValue = true;
|
||||||
OnToggleUpdate(UiIndex.ViewVelocity, false, true);
|
|
||||||
OnToggleUpdate(UiIndex.JumpRecover, false, true);
|
OnToggleUpdate(UiIndex.IgnoreLocal, true);
|
||||||
OnToggleUpdate(UiIndex.Buoyancy, true, true);
|
ms_ignoreLocalToggle.ToggleValue = true;
|
||||||
OnToggleUpdate(UiIndex.FallDamage, true, true);
|
|
||||||
OnSliderUpdate(UiIndex.VelocityMultiplier, 2f, true);
|
OnToggleUpdate(UiIndex.CombatReaction, true);
|
||||||
OnSliderUpdate(UiIndex.MovementDrag, 1f, true);
|
ms_combatToggle.ToggleValue = true;
|
||||||
OnSliderUpdate(UiIndex.AngularDrag, 1f, true);
|
|
||||||
OnSliderUpdate(UiIndex.RecoverDelay, 3f, true);
|
OnToggleUpdate(UiIndex.AutoRecover, false);
|
||||||
OnSliderUpdate(UiIndex.FallLimit, 5f, true);
|
ms_recoveryToggle.ToggleValue = false;
|
||||||
|
|
||||||
|
OnToggleUpdate(UiIndex.Slipperiness, false);
|
||||||
|
ms_slipperinessToggle.ToggleValue = false;
|
||||||
|
|
||||||
|
OnToggleUpdate(UiIndex.Bounciness, false);
|
||||||
|
ms_bouncinessToggle.ToggleValue = false;
|
||||||
|
|
||||||
|
OnToggleUpdate(UiIndex.ViewVelocity, false);
|
||||||
|
ms_viewDirectionToggle.ToggleValue = false;
|
||||||
|
|
||||||
|
OnToggleUpdate(UiIndex.JumpRecover, false);
|
||||||
|
ms_jumpRecoverToggle.ToggleValue = false;
|
||||||
|
|
||||||
|
OnToggleUpdate(UiIndex.Buoyancy, true);
|
||||||
|
ms_buoyancyToggle.ToggleValue = true;
|
||||||
|
|
||||||
|
OnToggleUpdate(UiIndex.FallDamage, true);
|
||||||
|
ms_fallDamageToggle.ToggleValue = true;
|
||||||
|
|
||||||
|
OnSliderUpdate(UiIndex.VelocityMultiplier, 2f);
|
||||||
|
ms_velocityMultiplierSlider.SetSliderValue(2f);
|
||||||
|
|
||||||
|
OnSliderUpdate(UiIndex.MovementDrag, 1f);
|
||||||
|
ms_movementDragSlider.SetSliderValue(1f);
|
||||||
|
|
||||||
|
OnSliderUpdate(UiIndex.AngularDrag, 1f);
|
||||||
|
ms_angularMovementDragSlider.SetSliderValue(1f);
|
||||||
|
|
||||||
|
OnSliderUpdate(UiIndex.RecoverDelay, 3f);
|
||||||
|
ms_recoverDelaySlider.SetSliderValue(3f);
|
||||||
|
|
||||||
|
OnSliderUpdate(UiIndex.FallLimit, 9.899494f);
|
||||||
|
ms_fallLimitSlider.SetSliderValue(9.899494f);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void OnHotkeyKeyChanged(UnityEngine.KeyCode p_keyCode)
|
||||||
|
{
|
||||||
|
if(ms_ragdollButton != null)
|
||||||
|
ms_hotkeyToggle.ToggleTooltip = string.Format(c_ragdollKeyTooltip, p_keyCode);
|
||||||
}
|
}
|
||||||
|
|
||||||
static Stream GetIconStream(string p_name)
|
static Stream GetIconStream(string p_name)
|
||||||
|
@ -255,5 +311,10 @@ namespace ml_prm
|
||||||
string l_assemblyName = l_assembly.GetName().Name;
|
string l_assemblyName = l_assembly.GetName().Name;
|
||||||
return l_assembly.GetManifestResourceStream(l_assemblyName + ".resources." + p_name);
|
return l_assembly.GetManifestResourceStream(l_assemblyName + ".resources." + p_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static float GetDropHeight(float p_speed, float p_gravity = 9.8f)
|
||||||
|
{
|
||||||
|
return MathF.Pow(p_speed, 2f) / (p_gravity * 2f);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
[assembly: MelonLoader.MelonInfo(typeof(ml_prm.PlayerRagdollMod), "PlayerRagdollMod", "1.1.7", "SDraw", "https://github.com/SDraw/ml_mods_cvr")]
|
[assembly: MelonLoader.MelonInfo(typeof(ml_prm.PlayerRagdollMod), "PlayerRagdollMod", "1.1.8", "SDraw", "https://github.com/SDraw/ml_mods_cvr")]
|
||||||
[assembly: MelonLoader.MelonGame(null, "ChilloutVR")]
|
[assembly: MelonLoader.MelonGame(null, "ChilloutVR")]
|
||||||
[assembly: MelonLoader.MelonPriority(2)]
|
[assembly: MelonLoader.MelonPriority(2)]
|
||||||
[assembly: MelonLoader.MelonOptionalDependencies("BTKUILib")]
|
[assembly: MelonLoader.MelonAdditionalDependencies("BTKUILib")]
|
||||||
[assembly: MelonLoader.MelonPlatform(MelonLoader.MelonPlatformAttribute.CompatiblePlatforms.WINDOWS_X64)]
|
[assembly: MelonLoader.MelonPlatform(MelonLoader.MelonPlatformAttribute.CompatiblePlatforms.WINDOWS_X64)]
|
||||||
[assembly: MelonLoader.MelonPlatformDomain(MelonLoader.MelonPlatformDomainAttribute.CompatibleDomains.MONO)]
|
[assembly: MelonLoader.MelonPlatformDomain(MelonLoader.MelonPlatformDomainAttribute.CompatibleDomains.MONO)]
|
||||||
[assembly: MelonLoader.MelonAdditionalCredits("kafeijao, NotAKidOnSteam")]
|
[assembly: MelonLoader.MelonAdditionalCredits("kafeijao, NotAKidOnSteam")]
|
||||||
|
|
192
ml_prm/RagdollBodypartHandler.cs
Normal file
192
ml_prm/RagdollBodypartHandler.cs
Normal file
|
@ -0,0 +1,192 @@
|
||||||
|
using ABI.CCK.Components;
|
||||||
|
using ABI_RC.Core.Player;
|
||||||
|
using ABI_RC.Core.Savior;
|
||||||
|
using ABI_RC.Systems.Movement;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace ml_prm
|
||||||
|
{
|
||||||
|
[DisallowMultipleComponent]
|
||||||
|
class RagdollBodypartHandler : MonoBehaviour, CVRTriggerVolume
|
||||||
|
{
|
||||||
|
const string c_ragdollPointerType = "ragdoll";
|
||||||
|
|
||||||
|
Rigidbody m_rigidBody = null;
|
||||||
|
public Collider collider { get; set; } = null;
|
||||||
|
PhysicsInfluencer m_physicsInfluencer = null;
|
||||||
|
|
||||||
|
bool m_shouldHaveInfluencer = false;
|
||||||
|
bool m_activeGravity = true;
|
||||||
|
|
||||||
|
// Unity events
|
||||||
|
void Awake()
|
||||||
|
{
|
||||||
|
this.gameObject.layer = LayerMask.NameToLayer("PlayerLocal");
|
||||||
|
|
||||||
|
collider = this.GetComponent<Collider>();
|
||||||
|
m_rigidBody = this.GetComponent<Rigidbody>();
|
||||||
|
|
||||||
|
if(m_rigidBody != null)
|
||||||
|
{
|
||||||
|
m_rigidBody.isKinematic = false;
|
||||||
|
m_rigidBody.detectCollisions = true;
|
||||||
|
m_rigidBody.useGravity = false;
|
||||||
|
m_rigidBody.collisionDetectionMode = CollisionDetectionMode.ContinuousDynamic;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(collider != null)
|
||||||
|
{
|
||||||
|
Physics.IgnoreCollision(collider, BetterBetterCharacterController.Instance.Collider, true);
|
||||||
|
Physics.IgnoreCollision(collider, BetterBetterCharacterController.Instance.KinematicTriggerProxy.Collider, true);
|
||||||
|
Physics.IgnoreCollision(collider, BetterBetterCharacterController.Instance.NonKinematicProxy.Collider, true);
|
||||||
|
Physics.IgnoreCollision(collider, BetterBetterCharacterController.Instance.SphereProxy.Collider, true);
|
||||||
|
BetterBetterCharacterController.Instance.IgnoreCollision(collider, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Start()
|
||||||
|
{
|
||||||
|
if(m_shouldHaveInfluencer && (m_rigidBody != null) && (collider != null))
|
||||||
|
{
|
||||||
|
m_physicsInfluencer = this.gameObject.AddComponent<PhysicsInfluencer>();
|
||||||
|
m_physicsInfluencer.fluidDrag = 3f;
|
||||||
|
m_physicsInfluencer.fluidAngularDrag = 1f;
|
||||||
|
m_physicsInfluencer.enableBuoyancy = true;
|
||||||
|
m_physicsInfluencer.enableInfluence = false;
|
||||||
|
m_physicsInfluencer.forceAlignUpright = false;
|
||||||
|
float mass = m_rigidBody.mass;
|
||||||
|
m_physicsInfluencer.UpdateDensity();
|
||||||
|
m_rigidBody.mass = mass;
|
||||||
|
m_physicsInfluencer.volume = mass * 0.005f;
|
||||||
|
m_physicsInfluencer.enableLocalGravity = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(collider != null)
|
||||||
|
{
|
||||||
|
CVRParticlePointerManager.volumes.Add(this);
|
||||||
|
CVRParticlePointerManager.UpdateParticleSystems();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void OnDestroy()
|
||||||
|
{
|
||||||
|
if(collider != null)
|
||||||
|
CVRParticlePointerManager.RemoveTrigger(collider);
|
||||||
|
}
|
||||||
|
|
||||||
|
void FixedUpdate()
|
||||||
|
{
|
||||||
|
if(m_rigidBody != null)
|
||||||
|
{
|
||||||
|
m_rigidBody.useGravity = false;
|
||||||
|
|
||||||
|
if(m_activeGravity && ((m_physicsInfluencer == null) || !m_physicsInfluencer.enableInfluence || !m_physicsInfluencer.GetSubmerged()))
|
||||||
|
m_rigidBody.AddForce(BetterBetterCharacterController.Instance.GravityResult.AppliedGravity * m_rigidBody.mass);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void OnTriggerEnter(Collider p_col)
|
||||||
|
{
|
||||||
|
if(Settings.PointersReaction && (RagdollController.Instance != null))
|
||||||
|
{
|
||||||
|
CVRPointer l_pointer = p_col.GetComponent<CVRPointer>();
|
||||||
|
if((l_pointer != null) && (l_pointer.type == c_ragdollPointerType) && !IsIgnored(l_pointer.transform) && !RagdollController.Instance.IsRagdolled())
|
||||||
|
RagdollController.Instance.SwitchRagdoll();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Arbitrary
|
||||||
|
public bool IsReady() => ((m_rigidBody != null) && (collider != null) && (!m_shouldHaveInfluencer || ((m_physicsInfluencer != null) && m_physicsInfluencer.IsReady())));
|
||||||
|
public void SetInfuencerUsage(bool p_state) => m_shouldHaveInfluencer = p_state;
|
||||||
|
|
||||||
|
public void SetColliderMaterial(PhysicMaterial p_material)
|
||||||
|
{
|
||||||
|
if(collider != null)
|
||||||
|
{
|
||||||
|
collider.sharedMaterial = p_material;
|
||||||
|
collider.material = p_material;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetAsKinematic(bool p_state)
|
||||||
|
{
|
||||||
|
if(collider != null)
|
||||||
|
collider.isTrigger = p_state;
|
||||||
|
if(m_rigidBody != null)
|
||||||
|
{
|
||||||
|
m_rigidBody.isKinematic = p_state;
|
||||||
|
m_rigidBody.collisionDetectionMode = (p_state ? CollisionDetectionMode.Discrete : CollisionDetectionMode.ContinuousDynamic);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetVelocity(Vector3 p_vec)
|
||||||
|
{
|
||||||
|
if(m_rigidBody != null)
|
||||||
|
m_rigidBody.velocity = p_vec;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetAngularVelocity(Vector3 p_vec)
|
||||||
|
{
|
||||||
|
if(m_rigidBody != null)
|
||||||
|
m_rigidBody.angularVelocity = p_vec;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetActiveGravity(bool p_state)
|
||||||
|
{
|
||||||
|
m_activeGravity = p_state;
|
||||||
|
|
||||||
|
if(m_physicsInfluencer != null)
|
||||||
|
m_physicsInfluencer.enabled = m_activeGravity;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetDrag(float p_value)
|
||||||
|
{
|
||||||
|
if(m_rigidBody != null)
|
||||||
|
{
|
||||||
|
m_rigidBody.drag = p_value;
|
||||||
|
m_rigidBody.WakeUp();
|
||||||
|
}
|
||||||
|
if(m_physicsInfluencer != null)
|
||||||
|
m_physicsInfluencer.airDrag = p_value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetAngularDrag(float p_value)
|
||||||
|
{
|
||||||
|
if(m_rigidBody != null)
|
||||||
|
{
|
||||||
|
m_rigidBody.angularDrag = p_value;
|
||||||
|
m_rigidBody.WakeUp();
|
||||||
|
}
|
||||||
|
if(m_physicsInfluencer != null)
|
||||||
|
m_physicsInfluencer.airAngularDrag = p_value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetBuoyancy(bool p_state)
|
||||||
|
{
|
||||||
|
if(m_physicsInfluencer != null)
|
||||||
|
m_physicsInfluencer.enableInfluence = p_state;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void ClearFluidVolumes()
|
||||||
|
{
|
||||||
|
if(m_physicsInfluencer != null)
|
||||||
|
m_physicsInfluencer.ClearFluidVolumes();
|
||||||
|
}
|
||||||
|
|
||||||
|
static bool IsIgnored(Transform p_transform)
|
||||||
|
{
|
||||||
|
return (Settings.IgnoreLocal && (p_transform.root == PlayerSetup.Instance.transform));
|
||||||
|
}
|
||||||
|
|
||||||
|
// CVRTriggerVolume
|
||||||
|
public void TriggerEnter(CVRPointer pointer)
|
||||||
|
{
|
||||||
|
if(Settings.PointersReaction && (RagdollController.Instance != null))
|
||||||
|
{
|
||||||
|
if((pointer != null) && (pointer.type == c_ragdollPointerType) && !IsIgnored(pointer.transform) && !RagdollController.Instance.IsRagdolled())
|
||||||
|
RagdollController.Instance.SwitchRagdoll();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public void TriggerExit(CVRPointer pointer) { }
|
||||||
|
}
|
||||||
|
}
|
|
@ -27,15 +27,12 @@ namespace ml_prm
|
||||||
bool m_enabled = false;
|
bool m_enabled = false;
|
||||||
bool m_forcedSwitch = false;
|
bool m_forcedSwitch = false;
|
||||||
|
|
||||||
readonly List<Rigidbody> m_rigidBodies = null;
|
|
||||||
readonly List<Collider> m_colliders = null;
|
|
||||||
Transform m_puppetRoot = null;
|
Transform m_puppetRoot = null;
|
||||||
Transform m_puppet = null;
|
Transform m_puppet = null;
|
||||||
BipedRagdollReferences m_puppetReferences;
|
BipedRagdollReferences m_puppetReferences;
|
||||||
|
readonly List<RagdollBodypartHandler> m_ragdollBodyHandlers = null;
|
||||||
readonly List<System.Tuple<Transform, Transform>> m_boneLinks = null;
|
readonly List<System.Tuple<Transform, Transform>> m_boneLinks = null;
|
||||||
readonly List<System.Tuple<CharacterJoint, Vector3>> m_jointAnchors = null;
|
readonly List<System.Tuple<CharacterJoint, Vector3>> m_jointAnchors = null;
|
||||||
readonly List<PhysicsInfluencer> m_physicsInfluencers = null;
|
|
||||||
readonly List<GravityInfluencer> m_gravityInfluencers = null;
|
|
||||||
|
|
||||||
bool m_avatarReady = false;
|
bool m_avatarReady = false;
|
||||||
Coroutine m_initCoroutine = null;
|
Coroutine m_initCoroutine = null;
|
||||||
|
@ -44,8 +41,7 @@ namespace ml_prm
|
||||||
Vector3 m_ragdollLastPos = Vector3.zero;
|
Vector3 m_ragdollLastPos = Vector3.zero;
|
||||||
bool m_wasSwimming = false;
|
bool m_wasSwimming = false;
|
||||||
|
|
||||||
RagdollToggle m_avatarRagdollToggle = null;
|
RagdollToggle m_avatarRagdollToggle = null; // Custom component available for editor
|
||||||
RagdollTrigger m_ragdollTrigger = null;
|
|
||||||
AvatarBoolParameter m_ragdolledParameter = null;
|
AvatarBoolParameter m_ragdolledParameter = null;
|
||||||
PhysicMaterial m_physicsMaterial = null;
|
PhysicMaterial m_physicsMaterial = null;
|
||||||
|
|
||||||
|
@ -54,24 +50,25 @@ namespace ml_prm
|
||||||
float m_downTime = float.MinValue;
|
float m_downTime = float.MinValue;
|
||||||
|
|
||||||
bool m_inAir = false;
|
bool m_inAir = false;
|
||||||
float m_inAirDistance = 0f;
|
|
||||||
|
|
||||||
internal RagdollController()
|
internal RagdollController()
|
||||||
{
|
{
|
||||||
m_rigidBodies = new List<Rigidbody>();
|
m_ragdollBodyHandlers = new List<RagdollBodypartHandler>();
|
||||||
m_colliders = new List<Collider>();
|
|
||||||
m_boneLinks = new List<System.Tuple<Transform, Transform>>();
|
m_boneLinks = new List<System.Tuple<Transform, Transform>>();
|
||||||
m_jointAnchors = new List<System.Tuple<CharacterJoint, Vector3>>();
|
m_jointAnchors = new List<System.Tuple<CharacterJoint, Vector3>>();
|
||||||
m_physicsInfluencers = new List<PhysicsInfluencer>();
|
|
||||||
m_gravityInfluencers = new List<GravityInfluencer>();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Unity events
|
// Unity events
|
||||||
|
void Awake()
|
||||||
|
{
|
||||||
|
if((Instance != null) && (Instance != this))
|
||||||
|
Object.Destroy(this);
|
||||||
|
else
|
||||||
|
Instance = this;
|
||||||
|
}
|
||||||
|
|
||||||
void Start()
|
void Start()
|
||||||
{
|
{
|
||||||
if(Instance == null)
|
|
||||||
Instance = this;
|
|
||||||
|
|
||||||
m_physicsMaterial = new PhysicMaterial("Ragdoll");
|
m_physicsMaterial = new PhysicMaterial("Ragdoll");
|
||||||
m_physicsMaterial.dynamicFriction = c_defaultFriction;
|
m_physicsMaterial.dynamicFriction = c_defaultFriction;
|
||||||
m_physicsMaterial.staticFriction = c_defaultFriction;
|
m_physicsMaterial.staticFriction = c_defaultFriction;
|
||||||
|
@ -84,9 +81,6 @@ namespace ml_prm
|
||||||
m_puppetRoot.localPosition = Vector3.zero;
|
m_puppetRoot.localPosition = Vector3.zero;
|
||||||
m_puppetRoot.localRotation = Quaternion.identity;
|
m_puppetRoot.localRotation = Quaternion.identity;
|
||||||
|
|
||||||
m_ragdollTrigger = BetterBetterCharacterController.Instance.NonKinematicProxy.gameObject.AddComponent<RagdollTrigger>();
|
|
||||||
m_ragdollTrigger.enabled = false;
|
|
||||||
|
|
||||||
Settings.OnMovementDragChanged.AddHandler(this.OnMovementDragChanged);
|
Settings.OnMovementDragChanged.AddHandler(this.OnMovementDragChanged);
|
||||||
Settings.OnAngularDragChanged.AddHandler(this.OnAngularDragChanged);
|
Settings.OnAngularDragChanged.AddHandler(this.OnAngularDragChanged);
|
||||||
Settings.OnGravityChanged.AddHandler(this.OnGravityChanged);
|
Settings.OnGravityChanged.AddHandler(this.OnGravityChanged);
|
||||||
|
@ -125,17 +119,11 @@ namespace ml_prm
|
||||||
m_puppetRoot = null;
|
m_puppetRoot = null;
|
||||||
|
|
||||||
m_puppet = null;
|
m_puppet = null;
|
||||||
m_rigidBodies.Clear();
|
m_ragdollBodyHandlers.Clear();
|
||||||
m_colliders.Clear();
|
|
||||||
m_boneLinks.Clear();
|
m_boneLinks.Clear();
|
||||||
m_jointAnchors.Clear();
|
m_jointAnchors.Clear();
|
||||||
m_physicsInfluencers.Clear();
|
|
||||||
m_avatarRagdollToggle = null;
|
m_avatarRagdollToggle = null;
|
||||||
|
|
||||||
if(m_ragdollTrigger != null)
|
|
||||||
Object.Destroy(m_ragdollTrigger);
|
|
||||||
m_ragdollTrigger = null;
|
|
||||||
|
|
||||||
if(m_physicsMaterial != null)
|
if(m_physicsMaterial != null)
|
||||||
Object.Destroy(m_physicsMaterial);
|
Object.Destroy(m_physicsMaterial);
|
||||||
m_physicsMaterial = null;
|
m_physicsMaterial = null;
|
||||||
|
@ -170,33 +158,23 @@ namespace ml_prm
|
||||||
{
|
{
|
||||||
bool l_grounded = BetterBetterCharacterController.Instance.IsGrounded();
|
bool l_grounded = BetterBetterCharacterController.Instance.IsGrounded();
|
||||||
bool l_inWater = BetterBetterCharacterController.Instance.IsInWater();
|
bool l_inWater = BetterBetterCharacterController.Instance.IsInWater();
|
||||||
if(m_inAir && l_grounded && !l_inWater && (m_inAirDistance > Settings.FallLimit))
|
if(m_inAir && l_grounded && !l_inWater && (m_velocity.magnitude >= Settings.FallLimit))
|
||||||
{
|
|
||||||
m_inAirDistance = 0f;
|
|
||||||
SwitchRagdoll();
|
SwitchRagdoll();
|
||||||
}
|
|
||||||
|
|
||||||
m_inAir = !(l_grounded || l_inWater);
|
m_inAir = !(l_grounded || l_inWater);
|
||||||
if(!m_inAir)
|
|
||||||
m_inAirDistance = 0f;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(m_avatarReady && m_enabled)
|
if(m_avatarReady && m_enabled)
|
||||||
{
|
{
|
||||||
m_inAirDistance = 0f;
|
|
||||||
BodySystem.TrackingPositionWeight = 0f;
|
BodySystem.TrackingPositionWeight = 0f;
|
||||||
|
BetterBetterCharacterController.Instance.PauseGroundConstraint();
|
||||||
|
BetterBetterCharacterController.Instance.ResetAllForces();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(m_avatarReady && !m_enabled)
|
if(m_avatarReady && !m_enabled)
|
||||||
{
|
{
|
||||||
Vector3 l_pos = PlayerSetup.Instance.transform.position;
|
Vector3 l_pos = PlayerSetup.Instance.transform.position;
|
||||||
m_velocity = (m_velocity + (l_pos - m_lastPosition) / Time.deltaTime) * 0.5f;
|
m_velocity = (m_velocity + (l_pos - m_lastPosition) / Time.deltaTime) * 0.5f;
|
||||||
if(m_inAir)
|
|
||||||
{
|
|
||||||
m_inAirDistance += (Quaternion.Inverse(PlayerSetup.Instance.transform.rotation) * (m_lastPosition - l_pos)).y;
|
|
||||||
m_inAirDistance = Mathf.Clamp(m_inAirDistance, 0f, float.MaxValue);
|
|
||||||
}
|
|
||||||
|
|
||||||
m_lastPosition = l_pos;
|
m_lastPosition = l_pos;
|
||||||
|
|
||||||
if(!m_reachedGround && BetterBetterCharacterController.Instance.IsOnGround())
|
if(!m_reachedGround && BetterBetterCharacterController.Instance.IsOnGround())
|
||||||
|
@ -220,9 +198,6 @@ namespace ml_prm
|
||||||
if((m_avatarRagdollToggle != null) && m_avatarRagdollToggle.isActiveAndEnabled && m_avatarRagdollToggle.shouldOverride && (m_enabled != m_avatarRagdollToggle.isOn))
|
if((m_avatarRagdollToggle != null) && m_avatarRagdollToggle.isActiveAndEnabled && m_avatarRagdollToggle.shouldOverride && (m_enabled != m_avatarRagdollToggle.isOn))
|
||||||
SwitchRagdoll();
|
SwitchRagdoll();
|
||||||
|
|
||||||
if((m_ragdollTrigger != null) && m_ragdollTrigger.GetStateWithReset() && m_avatarReady && !m_enabled && Settings.PointersReaction)
|
|
||||||
SwitchRagdoll();
|
|
||||||
|
|
||||||
if(Settings.Hotkey && Input.GetKeyDown(Settings.HotkeyKey) && !ViewManager.Instance.IsAnyMenuOpen)
|
if(Settings.Hotkey && Input.GetKeyDown(Settings.HotkeyKey) && !ViewManager.Instance.IsAnyMenuOpen)
|
||||||
SwitchRagdoll();
|
SwitchRagdoll();
|
||||||
|
|
||||||
|
@ -277,31 +252,21 @@ namespace ml_prm
|
||||||
Object.Destroy(m_puppet.gameObject);
|
Object.Destroy(m_puppet.gameObject);
|
||||||
m_puppet = null;
|
m_puppet = null;
|
||||||
|
|
||||||
if(m_ragdollTrigger != null)
|
|
||||||
{
|
|
||||||
m_ragdollTrigger.GetStateWithReset();
|
|
||||||
m_ragdollTrigger.enabled = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
m_vrIK = null;
|
m_vrIK = null;
|
||||||
m_applyHipsPosition = false;
|
m_applyHipsPosition = false;
|
||||||
m_enabled = false;
|
m_enabled = false;
|
||||||
m_avatarReady = false;
|
m_avatarReady = false;
|
||||||
m_avatarRagdollToggle = null;
|
m_avatarRagdollToggle = null;
|
||||||
m_ragdolledParameter = null;
|
m_ragdolledParameter = null;
|
||||||
m_rigidBodies.Clear();
|
|
||||||
m_colliders.Clear();
|
|
||||||
m_puppetReferences = new BipedRagdollReferences();
|
m_puppetReferences = new BipedRagdollReferences();
|
||||||
|
m_ragdollBodyHandlers.Clear();
|
||||||
m_boneLinks.Clear();
|
m_boneLinks.Clear();
|
||||||
m_jointAnchors.Clear();
|
m_jointAnchors.Clear();
|
||||||
m_physicsInfluencers.Clear();
|
|
||||||
m_gravityInfluencers.Clear();
|
|
||||||
m_reachedGround = true;
|
m_reachedGround = true;
|
||||||
m_groundedTime = 0f;
|
m_groundedTime = 0f;
|
||||||
m_downTime = float.MinValue;
|
m_downTime = float.MinValue;
|
||||||
m_puppetRoot.localScale = Vector3.one;
|
m_puppetRoot.localScale = Vector3.one;
|
||||||
m_inAir = false;
|
m_inAir = false;
|
||||||
m_inAirDistance = 0f;
|
|
||||||
m_wasSwimming = false;
|
m_wasSwimming = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -353,26 +318,11 @@ namespace ml_prm
|
||||||
|
|
||||||
Transform[] l_puppetTransforms = m_puppetReferences.GetRagdollTransforms();
|
Transform[] l_puppetTransforms = m_puppetReferences.GetRagdollTransforms();
|
||||||
Transform[] l_avatarTransforms = l_avatarReferences.GetRagdollTransforms();
|
Transform[] l_avatarTransforms = l_avatarReferences.GetRagdollTransforms();
|
||||||
|
Transform[] l_influencedTransforms = new Transform[] { m_puppetReferences.hips, m_puppetReferences.spine, m_puppetReferences.chest };
|
||||||
for(int i = 0; i < l_puppetTransforms.Length; i++)
|
for(int i = 0; i < l_puppetTransforms.Length; i++)
|
||||||
{
|
{
|
||||||
if(l_puppetTransforms[i] != null)
|
if(l_puppetTransforms[i] != null)
|
||||||
{
|
{
|
||||||
Rigidbody l_body = l_puppetTransforms[i].GetComponent<Rigidbody>();
|
|
||||||
if(l_body != null)
|
|
||||||
{
|
|
||||||
m_rigidBodies.Add(l_body);
|
|
||||||
l_body.isKinematic = true;
|
|
||||||
l_body.angularDrag = Settings.AngularDrag;
|
|
||||||
l_body.drag = (WorldHandler.IsSafeWorld() ? Settings.MovementDrag : 1f);
|
|
||||||
l_body.useGravity = false;
|
|
||||||
l_body.collisionDetectionMode = CollisionDetectionMode.ContinuousDynamic;
|
|
||||||
l_body.gameObject.layer = LayerMask.NameToLayer("PlayerLocal");
|
|
||||||
|
|
||||||
GravityInfluencer l_gravInfluencer = l_body.gameObject.AddComponent<GravityInfluencer>();
|
|
||||||
l_gravInfluencer.SetActiveGravity((!WorldHandler.IsSafeWorld() || Settings.Gravity));
|
|
||||||
m_gravityInfluencers.Add(l_gravInfluencer);
|
|
||||||
}
|
|
||||||
|
|
||||||
CharacterJoint l_joint = l_puppetTransforms[i].GetComponent<CharacterJoint>();
|
CharacterJoint l_joint = l_puppetTransforms[i].GetComponent<CharacterJoint>();
|
||||||
if(l_joint != null)
|
if(l_joint != null)
|
||||||
{
|
{
|
||||||
|
@ -381,37 +331,13 @@ namespace ml_prm
|
||||||
m_jointAnchors.Add(System.Tuple.Create(l_joint, l_joint.connectedAnchor));
|
m_jointAnchors.Add(System.Tuple.Create(l_joint, l_joint.connectedAnchor));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Rigidbody l_body = l_puppetTransforms[i].GetComponent<Rigidbody>();
|
||||||
Collider l_collider = l_puppetTransforms[i].GetComponent<Collider>();
|
Collider l_collider = l_puppetTransforms[i].GetComponent<Collider>();
|
||||||
if(l_collider != null)
|
if((l_body != null) && (l_collider != null))
|
||||||
{
|
{
|
||||||
Physics.IgnoreCollision(l_collider, BetterBetterCharacterController.Instance.Collider, true);
|
RagdollBodypartHandler l_handler = l_puppetTransforms[i].gameObject.AddComponent<RagdollBodypartHandler>();
|
||||||
Physics.IgnoreCollision(l_collider, BetterBetterCharacterController.Instance.KinematicTriggerProxy.Collider, true);
|
l_handler.SetInfuencerUsage(Utils.IsInEnumeration(l_puppetTransforms[i], l_influencedTransforms));
|
||||||
Physics.IgnoreCollision(l_collider, BetterBetterCharacterController.Instance.NonKinematicProxy.Collider, true);
|
m_ragdollBodyHandlers.Add(l_handler);
|
||||||
Physics.IgnoreCollision(l_collider, BetterBetterCharacterController.Instance.SphereProxy.Collider, true);
|
|
||||||
BetterBetterCharacterController.Instance.IgnoreCollision(l_collider, true);
|
|
||||||
|
|
||||||
l_collider.sharedMaterial = m_physicsMaterial;
|
|
||||||
l_collider.material = m_physicsMaterial;
|
|
||||||
m_colliders.Add(l_collider);
|
|
||||||
}
|
|
||||||
|
|
||||||
if((l_body != null) && (l_collider != null) && (l_puppetTransforms[i] == m_puppetReferences.hips || l_puppetTransforms[i] == m_puppetReferences.spine || l_puppetTransforms[i] == m_puppetReferences.chest))
|
|
||||||
{
|
|
||||||
PhysicsInfluencer l_physicsInfluencer = l_puppetTransforms[i].gameObject.AddComponent<PhysicsInfluencer>();
|
|
||||||
l_physicsInfluencer.airDrag = (WorldHandler.IsSafeWorld() ? Settings.MovementDrag : 1f);
|
|
||||||
l_physicsInfluencer.airAngularDrag = Settings.AngularDrag;
|
|
||||||
l_physicsInfluencer.fluidDrag = 3f;
|
|
||||||
l_physicsInfluencer.fluidAngularDrag = 1f;
|
|
||||||
l_physicsInfluencer.enableBuoyancy = true;
|
|
||||||
l_physicsInfluencer.enableInfluence = false;
|
|
||||||
l_physicsInfluencer.forceAlignUpright = false;
|
|
||||||
float mass = l_body.mass;
|
|
||||||
l_physicsInfluencer.UpdateDensity();
|
|
||||||
l_body.mass = mass;
|
|
||||||
l_physicsInfluencer.volume = mass * 0.005f;
|
|
||||||
l_physicsInfluencer.enableLocalGravity = true;
|
|
||||||
|
|
||||||
m_physicsInfluencers.Add(l_physicsInfluencer);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(l_avatarTransforms[i] != null)
|
if(l_avatarTransforms[i] != null)
|
||||||
|
@ -422,7 +348,6 @@ namespace ml_prm
|
||||||
// And return back
|
// And return back
|
||||||
m_puppetRoot.localPosition = Vector3.zero;
|
m_puppetRoot.localPosition = Vector3.zero;
|
||||||
m_puppetRoot.localRotation = Quaternion.identity;
|
m_puppetRoot.localRotation = Quaternion.identity;
|
||||||
m_puppetRoot.gameObject.SetActive(true);
|
|
||||||
|
|
||||||
m_vrIK = PlayerSetup.Instance._avatar.GetComponent<VRIK>();
|
m_vrIK = PlayerSetup.Instance._avatar.GetComponent<VRIK>();
|
||||||
if(m_vrIK != null)
|
if(m_vrIK != null)
|
||||||
|
@ -431,25 +356,28 @@ namespace ml_prm
|
||||||
m_avatarRagdollToggle = PlayerSetup.Instance._avatar.GetComponentInChildren<RagdollToggle>(true);
|
m_avatarRagdollToggle = PlayerSetup.Instance._avatar.GetComponentInChildren<RagdollToggle>(true);
|
||||||
m_ragdolledParameter = new AvatarBoolParameter("Ragdolled", PlayerSetup.Instance.animatorManager);
|
m_ragdolledParameter = new AvatarBoolParameter("Ragdolled", PlayerSetup.Instance.animatorManager);
|
||||||
|
|
||||||
m_initCoroutine = StartCoroutine(WaitForPhysicsInfluencers());
|
m_initCoroutine = StartCoroutine(WaitForBodyHandlers());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
IEnumerator WaitForPhysicsInfluencers()
|
IEnumerator WaitForBodyHandlers()
|
||||||
{
|
{
|
||||||
while(!m_physicsInfluencers.TrueForAll(p => p.IsReady()))
|
while(!m_ragdollBodyHandlers.TrueForAll(p => p.IsReady()))
|
||||||
yield return null;
|
yield return null;
|
||||||
|
|
||||||
m_puppetRoot.gameObject.SetActive(false);
|
foreach(RagdollBodypartHandler l_handler in m_ragdollBodyHandlers)
|
||||||
|
{
|
||||||
|
l_handler.SetAsKinematic(true);
|
||||||
|
l_handler.SetColliderMaterial(m_physicsMaterial);
|
||||||
|
}
|
||||||
|
|
||||||
m_ragdollTrigger.enabled = true;
|
|
||||||
m_avatarReady = true;
|
m_avatarReady = true;
|
||||||
m_initCoroutine = null;
|
m_initCoroutine = null;
|
||||||
|
|
||||||
OnGravityChanged(Settings.Gravity);
|
|
||||||
OnBuoyancyChanged(Settings.Buoyancy);
|
|
||||||
OnMovementDragChanged(Settings.MovementDrag);
|
OnMovementDragChanged(Settings.MovementDrag);
|
||||||
OnAngularDragChanged(Settings.AngularDrag);
|
OnAngularDragChanged(Settings.AngularDrag);
|
||||||
|
OnGravityChanged(Settings.Gravity);
|
||||||
|
OnBuoyancyChanged(Settings.Buoyancy);
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnAvatarPreReuse()
|
void OnAvatarPreReuse()
|
||||||
|
@ -573,28 +501,16 @@ namespace ml_prm
|
||||||
if(m_avatarReady)
|
if(m_avatarReady)
|
||||||
{
|
{
|
||||||
float l_drag = (WorldHandler.IsSafeWorld() ? p_value : 1f);
|
float l_drag = (WorldHandler.IsSafeWorld() ? p_value : 1f);
|
||||||
foreach(Rigidbody l_body in m_rigidBodies)
|
foreach(RagdollBodypartHandler l_handler in m_ragdollBodyHandlers)
|
||||||
{
|
l_handler.SetDrag(l_drag);
|
||||||
l_body.drag = l_drag;
|
|
||||||
if(m_enabled)
|
|
||||||
l_body.WakeUp();
|
|
||||||
}
|
|
||||||
foreach(PhysicsInfluencer l_influencer in m_physicsInfluencers)
|
|
||||||
l_influencer.airDrag = l_drag;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void OnAngularDragChanged(float p_value)
|
void OnAngularDragChanged(float p_value)
|
||||||
{
|
{
|
||||||
if(m_avatarReady)
|
if(m_avatarReady)
|
||||||
{
|
{
|
||||||
foreach(Rigidbody l_body in m_rigidBodies)
|
foreach(RagdollBodypartHandler l_handler in m_ragdollBodyHandlers)
|
||||||
{
|
l_handler.SetAngularDrag(p_value);
|
||||||
l_body.angularDrag = p_value;
|
|
||||||
if(m_enabled)
|
|
||||||
l_body.WakeUp();
|
|
||||||
}
|
|
||||||
foreach(PhysicsInfluencer l_influencer in m_physicsInfluencers)
|
|
||||||
l_influencer.airAngularDrag = p_value;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void OnGravityChanged(bool p_state)
|
void OnGravityChanged(bool p_state)
|
||||||
|
@ -602,10 +518,8 @@ namespace ml_prm
|
||||||
if(m_avatarReady)
|
if(m_avatarReady)
|
||||||
{
|
{
|
||||||
bool l_gravity = (!WorldHandler.IsSafeWorld() || p_state);
|
bool l_gravity = (!WorldHandler.IsSafeWorld() || p_state);
|
||||||
foreach(PhysicsInfluencer l_influencer in m_physicsInfluencers)
|
foreach(RagdollBodypartHandler l_handler in m_ragdollBodyHandlers)
|
||||||
l_influencer.enabled = l_gravity;
|
l_handler.SetActiveGravity(l_gravity);
|
||||||
foreach(GravityInfluencer l_influencer in m_gravityInfluencers)
|
|
||||||
l_influencer.SetActiveGravity(l_gravity);
|
|
||||||
|
|
||||||
if(!l_gravity)
|
if(!l_gravity)
|
||||||
{
|
{
|
||||||
|
@ -632,8 +546,8 @@ namespace ml_prm
|
||||||
if(m_avatarReady)
|
if(m_avatarReady)
|
||||||
{
|
{
|
||||||
bool l_buoyancy = (!WorldHandler.IsSafeWorld() || p_state);
|
bool l_buoyancy = (!WorldHandler.IsSafeWorld() || p_state);
|
||||||
foreach(PhysicsInfluencer l_influencer in m_physicsInfluencers)
|
foreach(RagdollBodypartHandler l_handler in m_ragdollBodyHandlers)
|
||||||
l_influencer.enableInfluence = l_buoyancy;
|
l_handler.SetBuoyancy(l_buoyancy);
|
||||||
|
|
||||||
if(!l_buoyancy)
|
if(!l_buoyancy)
|
||||||
{
|
{
|
||||||
|
@ -645,7 +559,6 @@ namespace ml_prm
|
||||||
void OnFallDamageChanged(bool p_state)
|
void OnFallDamageChanged(bool p_state)
|
||||||
{
|
{
|
||||||
m_inAir = false;
|
m_inAir = false;
|
||||||
m_inAirDistance = 0f;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Arbitrary
|
// Arbitrary
|
||||||
|
@ -663,6 +576,8 @@ namespace ml_prm
|
||||||
BetterBetterCharacterController.Instance.ChangeFlight(false, true);
|
BetterBetterCharacterController.Instance.ChangeFlight(false, true);
|
||||||
BetterBetterCharacterController.Instance.SetImmobilized(true);
|
BetterBetterCharacterController.Instance.SetImmobilized(true);
|
||||||
BetterBetterCharacterController.Instance.ClearFluidVolumes();
|
BetterBetterCharacterController.Instance.ClearFluidVolumes();
|
||||||
|
BetterBetterCharacterController.Instance.ResetAllForces();
|
||||||
|
BetterBetterCharacterController.Instance.PauseGroundConstraint();
|
||||||
BodySystem.TrackingPositionWeight = 0f;
|
BodySystem.TrackingPositionWeight = 0f;
|
||||||
m_applyHipsPosition = IKSystem.Instance.applyOriginalHipPosition;
|
m_applyHipsPosition = IKSystem.Instance.applyOriginalHipPosition;
|
||||||
IKSystem.Instance.applyOriginalHipPosition = true;
|
IKSystem.Instance.applyOriginalHipPosition = true;
|
||||||
|
@ -678,10 +593,11 @@ namespace ml_prm
|
||||||
m_groundedTime = 0f;
|
m_groundedTime = 0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_puppetRoot.gameObject.SetActive(true);
|
foreach(RagdollBodypartHandler l_handler in m_ragdollBodyHandlers)
|
||||||
|
l_handler.SetAsKinematic(false);
|
||||||
|
|
||||||
foreach(Rigidbody l_body in m_rigidBodies)
|
m_puppetRoot.gameObject.SetActive(false); //
|
||||||
l_body.isKinematic = false;
|
m_puppetRoot.gameObject.SetActive(true); // Resets rigidbodies and joints inner physics states
|
||||||
|
|
||||||
Vector3 l_velocity = Vector3.ClampMagnitude(m_velocity * (WorldHandler.IsSafeWorld() ? Settings.VelocityMultiplier : 1f), WorldHandler.GetMovementLimit());
|
Vector3 l_velocity = Vector3.ClampMagnitude(m_velocity * (WorldHandler.IsSafeWorld() ? Settings.VelocityMultiplier : 1f), WorldHandler.GetMovementLimit());
|
||||||
if(Settings.ViewVelocity && WorldHandler.IsSafeWorld())
|
if(Settings.ViewVelocity && WorldHandler.IsSafeWorld())
|
||||||
|
@ -690,10 +606,10 @@ namespace ml_prm
|
||||||
l_velocity = PlayerSetup.Instance.GetActiveCamera().transform.forward * l_mag;
|
l_velocity = PlayerSetup.Instance.GetActiveCamera().transform.forward * l_mag;
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach(Rigidbody l_body in m_rigidBodies)
|
foreach(RagdollBodypartHandler l_handler in m_ragdollBodyHandlers)
|
||||||
{
|
{
|
||||||
l_body.velocity = l_velocity;
|
l_handler.SetVelocity(l_velocity);
|
||||||
l_body.angularVelocity = Vector3.zero;
|
l_handler.SetAngularVelocity(Vector3.zero);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_ragdollLastPos = m_puppetReferences.hips.position;
|
m_ragdollLastPos = m_puppetReferences.hips.position;
|
||||||
|
@ -723,15 +639,14 @@ namespace ml_prm
|
||||||
|
|
||||||
m_ragdolledParameter.SetValue(false);
|
m_ragdolledParameter.SetValue(false);
|
||||||
|
|
||||||
m_puppetRoot.gameObject.SetActive(false);
|
|
||||||
m_puppetRoot.localPosition = Vector3.zero;
|
m_puppetRoot.localPosition = Vector3.zero;
|
||||||
m_puppetRoot.localRotation = Quaternion.identity;
|
m_puppetRoot.localRotation = Quaternion.identity;
|
||||||
|
|
||||||
foreach(Rigidbody l_body in m_rigidBodies)
|
foreach(RagdollBodypartHandler l_handler in m_ragdollBodyHandlers)
|
||||||
l_body.isKinematic = true;
|
{
|
||||||
|
l_handler.SetAsKinematic(true);
|
||||||
foreach(PhysicsInfluencer l_physicsInfluencer in m_physicsInfluencers)
|
l_handler.ClearFluidVolumes();
|
||||||
l_physicsInfluencer.ClearFluidVolumes();
|
}
|
||||||
|
|
||||||
m_lastPosition = PlayerSetup.Instance.transform.position;
|
m_lastPosition = PlayerSetup.Instance.transform.position;
|
||||||
m_velocity = Vector3.zero;
|
m_velocity = Vector3.zero;
|
||||||
|
@ -762,7 +677,6 @@ namespace ml_prm
|
||||||
}
|
}
|
||||||
|
|
||||||
m_inAir = false;
|
m_inAir = false;
|
||||||
m_inAirDistance = 0f;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static Transform CloneTransform(Transform p_source, Transform p_parent, string p_name)
|
static Transform CloneTransform(Transform p_source, Transform p_parent, string p_name)
|
||||||
|
|
|
@ -1,108 +0,0 @@
|
||||||
using ABI.CCK.Components;
|
|
||||||
using ABI_RC.Core.Player;
|
|
||||||
using ABI_RC.Core.Savior;
|
|
||||||
using UnityEngine;
|
|
||||||
|
|
||||||
namespace ml_prm
|
|
||||||
{
|
|
||||||
[DisallowMultipleComponent]
|
|
||||||
class RagdollTrigger : MonoBehaviour
|
|
||||||
{
|
|
||||||
const string c_ragdollPointerType = "ragdoll";
|
|
||||||
|
|
||||||
Collider m_collider = null;
|
|
||||||
Collider m_lastColliderTrigger = null;
|
|
||||||
ParticleSystem m_lastParticleSystemTrigger = null;
|
|
||||||
bool m_triggered = false;
|
|
||||||
|
|
||||||
void Start()
|
|
||||||
{
|
|
||||||
m_collider = this.GetComponent<Collider>();
|
|
||||||
|
|
||||||
CVRParticlePointerManager.volumes.Add(new RagdollTriggerVolume(m_collider, this));
|
|
||||||
CVRParticlePointerManager.UpdateParticleSystems();
|
|
||||||
}
|
|
||||||
|
|
||||||
void OnDestroy()
|
|
||||||
{
|
|
||||||
if(m_collider != null)
|
|
||||||
CVRParticlePointerManager.RemoveTrigger(m_collider);
|
|
||||||
m_collider = null;
|
|
||||||
|
|
||||||
m_lastColliderTrigger = null;
|
|
||||||
m_lastParticleSystemTrigger = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Update()
|
|
||||||
{
|
|
||||||
if(!ReferenceEquals(m_lastColliderTrigger, null))
|
|
||||||
{
|
|
||||||
if(m_lastColliderTrigger != null)
|
|
||||||
{
|
|
||||||
if(!m_collider.bounds.Intersects(m_lastColliderTrigger.bounds))
|
|
||||||
m_lastColliderTrigger = null;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
m_lastColliderTrigger = null;
|
|
||||||
}
|
|
||||||
if(!ReferenceEquals(m_lastParticleSystemTrigger, null))
|
|
||||||
{
|
|
||||||
if(m_lastParticleSystemTrigger != null)
|
|
||||||
{
|
|
||||||
if(m_lastParticleSystemTrigger.particleCount == 0)
|
|
||||||
m_lastParticleSystemTrigger = null;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
m_lastParticleSystemTrigger = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void OnTriggerEnter(Collider p_other)
|
|
||||||
{
|
|
||||||
CVRPointer l_pointer = p_other.GetComponent<CVRPointer>();
|
|
||||||
if((l_pointer != null) && (l_pointer.type == c_ragdollPointerType) && !IsIgnored(l_pointer.transform) && (m_lastColliderTrigger != p_other))
|
|
||||||
{
|
|
||||||
m_lastColliderTrigger = p_other;
|
|
||||||
m_triggered = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void OnTriggerExit(Collider p_other)
|
|
||||||
{
|
|
||||||
if(m_lastColliderTrigger == p_other)
|
|
||||||
m_lastColliderTrigger = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void OnPointerParticleEnter(CVRPointer p_pointer)
|
|
||||||
{
|
|
||||||
if(!this.gameObject.activeInHierarchy)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if((p_pointer.type == c_ragdollPointerType) && !IsIgnored(p_pointer.transform) && (m_lastParticleSystemTrigger != p_pointer.particleSystem))
|
|
||||||
{
|
|
||||||
m_lastParticleSystemTrigger = p_pointer.particleSystem;
|
|
||||||
m_triggered = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void OnPointerParticleExit(CVRPointer p_pointer)
|
|
||||||
{
|
|
||||||
// This seems to be very unreliable, and it's causing weird behavior
|
|
||||||
// if (!gameObject.activeInHierarchy) return;
|
|
||||||
// if(m_lastParticleSystemTrigger == p_pointer.particleSystem)
|
|
||||||
// m_lastParticleSystemTrigger = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool GetStateWithReset()
|
|
||||||
{
|
|
||||||
bool l_state = m_triggered;
|
|
||||||
m_triggered = false;
|
|
||||||
return l_state;
|
|
||||||
}
|
|
||||||
|
|
||||||
static bool IsIgnored(Transform p_transform)
|
|
||||||
{
|
|
||||||
return (Settings.IgnoreLocal && (p_transform.root == PlayerSetup.Instance.transform));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,22 +0,0 @@
|
||||||
using ABI_RC.Core.Savior;
|
|
||||||
using ABI.CCK.Components;
|
|
||||||
using UnityEngine;
|
|
||||||
|
|
||||||
namespace ml_prm
|
|
||||||
{
|
|
||||||
class RagdollTriggerVolume : CVRTriggerVolume
|
|
||||||
{
|
|
||||||
readonly RagdollTrigger m_trigger = null;
|
|
||||||
|
|
||||||
public Collider collider { get; set; }
|
|
||||||
|
|
||||||
internal RagdollTriggerVolume(Collider p_collider, RagdollTrigger p_trigger)
|
|
||||||
{
|
|
||||||
collider = p_collider;
|
|
||||||
m_trigger = p_trigger;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void TriggerEnter(CVRPointer pointer) => m_trigger.OnPointerParticleEnter(pointer);
|
|
||||||
public void TriggerExit(CVRPointer pointer) => m_trigger.OnPointerParticleExit(pointer);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -53,7 +53,7 @@ namespace ml_prm
|
||||||
public static bool JumpRecover { get; private set; } = false;
|
public static bool JumpRecover { get; private set; } = false;
|
||||||
public static bool Buoyancy { get; private set; } = true;
|
public static bool Buoyancy { get; private set; } = true;
|
||||||
public static bool FallDamage { get; private set; } = true;
|
public static bool FallDamage { get; private set; } = true;
|
||||||
public static float FallLimit { get; private set; } = 5f;
|
public static float FallLimit { get; private set; } = 9.899494f;
|
||||||
|
|
||||||
public static readonly SettingEvent<bool> OnHotkeyChanged = new SettingEvent<bool>();
|
public static readonly SettingEvent<bool> OnHotkeyChanged = new SettingEvent<bool>();
|
||||||
public static readonly SettingEvent<KeyCode> OnHotkeyKeyChanged = new SettingEvent<KeyCode>();
|
public static readonly SettingEvent<KeyCode> OnHotkeyKeyChanged = new SettingEvent<KeyCode>();
|
||||||
|
@ -122,7 +122,7 @@ namespace ml_prm
|
||||||
JumpRecover = (bool)ms_entries[(int)ModSetting.JumpRecover].BoxedValue;
|
JumpRecover = (bool)ms_entries[(int)ModSetting.JumpRecover].BoxedValue;
|
||||||
Buoyancy = (bool)ms_entries[(int)ModSetting.Buoyancy].BoxedValue;
|
Buoyancy = (bool)ms_entries[(int)ModSetting.Buoyancy].BoxedValue;
|
||||||
FallDamage = (bool)ms_entries[(int)ModSetting.FallDamage].BoxedValue;
|
FallDamage = (bool)ms_entries[(int)ModSetting.FallDamage].BoxedValue;
|
||||||
FallLimit = Mathf.Clamp((float)ms_entries[(int)ModSetting.FallLimit].BoxedValue, 0f, 100f);
|
FallLimit = Mathf.Clamp((float)ms_entries[(int)ModSetting.FallLimit].BoxedValue, 4.5f, 44.5f);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void OnMelonSettingSave_HotkeyKey(object p_oldValue, object p_newValue)
|
static void OnMelonSettingSave_HotkeyKey(object p_oldValue, object p_newValue)
|
||||||
|
|
|
@ -6,6 +6,7 @@ using ABI_RC.Systems.Movement;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
using System.Linq;
|
||||||
|
|
||||||
namespace ml_prm
|
namespace ml_prm
|
||||||
{
|
{
|
||||||
|
@ -40,5 +41,7 @@ namespace ml_prm
|
||||||
PlayerSetup.Instance._avatar.transform.localPosition = Vector3.zero;
|
PlayerSetup.Instance._avatar.transform.localPosition = Vector3.zero;
|
||||||
PlayerSetup.Instance._avatar.transform.localRotation = Quaternion.identity;
|
PlayerSetup.Instance._avatar.transform.localRotation = Quaternion.identity;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static bool IsInEnumeration(object p_obj, object[] p_enumeration) => p_enumeration.Contains(p_obj);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
<TargetFramework>netstandard2.1</TargetFramework>
|
<TargetFramework>netstandard2.1</TargetFramework>
|
||||||
<Platforms>x64</Platforms>
|
<Platforms>x64</Platforms>
|
||||||
<PackageId>PlayerRagdollMod</PackageId>
|
<PackageId>PlayerRagdollMod</PackageId>
|
||||||
<Version>1.1.7</Version>
|
<Version>1.1.8</Version>
|
||||||
<Authors>SDraw</Authors>
|
<Authors>SDraw</Authors>
|
||||||
<Company>None</Company>
|
<Company>None</Company>
|
||||||
<Product>PlayerRagdollMod</Product>
|
<Product>PlayerRagdollMod</Product>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue