Root rotation for all axes

This commit is contained in:
SDraw 2022-11-05 18:22:59 +03:00
parent 88767e8a52
commit b7d1078270
No known key found for this signature in database
GPG key ID: BB95B4DAB2BB8BB5
6 changed files with 54 additions and 18 deletions

View file

@ -8,5 +8,5 @@ Merged set of MelonLoader mods for ChilloutVR.
| Desktop Head Tracking | ml_dht | 1.0.7 | Yes | Working |
| Desktop Reticle Switch | ml_drs | 1.0.0 | Yes | Working |
| Four Point Tracking | ml_fpt | 1.0.9 | Yes | Working |
| Leap Motion Extension | ml_lme | 1.2.4 | Yes | Working |
| Leap Motion Extension | ml_lme | 1.2.6 | Yes, pending update | Working |
| Server Connection Info | ml_sci | 1.0.2 | Yes | Working |

View file

@ -214,10 +214,10 @@ namespace ml_lme
}
}
void OnRootAngleChange(float p_angle)
void OnRootAngleChange(Vector3 p_angle)
{
if(m_leapTrackingRoot != null)
m_leapTrackingRoot.transform.localRotation = Quaternion.Euler(p_angle, 0f, 0f);
m_leapTrackingRoot.transform.localRotation = Quaternion.Euler(p_angle);
}
void OnHeadAttachChange(bool p_state)
@ -255,7 +255,7 @@ namespace ml_lme
}
}
m_leapTrackingRoot.transform.localRotation = Quaternion.Euler(Settings.RootAngle, 0f, 0f);
m_leapTrackingRoot.transform.localRotation = Quaternion.Euler(Settings.RootAngle);
}
}

View file

@ -1,10 +1,10 @@
using System.Reflection;
[assembly: AssemblyTitle("LeapMotionExtension")]
[assembly: AssemblyVersion("1.2.4")]
[assembly: AssemblyFileVersion("1.2.4")]
[assembly: AssemblyVersion("1.2.6")]
[assembly: AssemblyFileVersion("1.2.6")]
[assembly: MelonLoader.MelonInfo(typeof(ml_lme.LeapMotionExtension), "LeapMotionExtension", "1.2.4", "SDraw", "https://github.com/SDraw/ml_mods_cvr")]
[assembly: MelonLoader.MelonInfo(typeof(ml_lme.LeapMotionExtension), "LeapMotionExtension", "1.2.6", "SDraw", "https://github.com/SDraw/ml_mods_cvr")]
[assembly: MelonLoader.MelonGame(null, "ChilloutVR")]
[assembly: MelonLoader.MelonPlatform(MelonLoader.MelonPlatformAttribute.CompatiblePlatforms.WINDOWS_X64)]
[assembly: MelonLoader.MelonPlatformDomain(MelonLoader.MelonPlatformDomainAttribute.CompatibleDomains.MONO)]

View file

@ -17,7 +17,7 @@ Available mod's settings in `Settings - Implementation - Leap Motion Tracking`:
* **Desktop offset X/Y/Z:** offset position for body attachment, (0, -45, 30) by default.
* **Attach to head:** attach hands transformation to head instead of body, disabled by default.
* **Head offset X/Y/Z:** offset position for head attachment (`Attach to head` is **`true`**), (0, -30, 15) by default.
* **Offset angle:** rotation around X axis, useful for neck mounts, 0 by default.
* **Offset angle X/Y/X:** rotation around specific axis, useful for neck mounts, 0 by default.
* **Track elbows:** elbows tracking, works best in `Screentop` and `HMD` tracking modes, `true` by default.
* **Fingers tracking only:** apply only fingers tracking, disabled by default.
* **Model visibility:** show Leap Motion controller model, useful for tracking visualizing, disabled by default.

View file

@ -24,7 +24,9 @@ namespace ml_lme
FingersOnly,
Model,
Mode,
Angle,
AngleX,
AngleY,
AngleZ,
Head,
HeadX,
HeadY,
@ -37,7 +39,7 @@ namespace ml_lme
static bool ms_fingersOnly = false;
static bool ms_modelVisibility = false;
static LeapTrackingMode ms_trackingMode = LeapTrackingMode.Desktop;
static float ms_rootAngle = 0f;
static Vector3 ms_rootAngle = Vector3.zero;
static bool ms_headAttach = false;
static Vector3 ms_headOffset = new Vector3(0f, -0.3f, 0.15f);
static bool ms_trackElbows = true;
@ -50,7 +52,7 @@ namespace ml_lme
static public event Action<bool> FingersOnlyChange;
static public event Action<bool> ModelVisibilityChange;
static public event Action<LeapTrackingMode> TrackingModeChange;
static public event Action<float> RootAngleChange;
static public event Action<Vector3> RootAngleChange;
static public event Action<bool> HeadAttachChange;
static public event Action<Vector3> HeadOffsetChange;
static public event Action<bool> TrackElbowsChange;
@ -67,7 +69,9 @@ namespace ml_lme
ms_entries.Add(ms_category.CreateEntry(ModSetting.FingersOnly.ToString(), ms_modelVisibility));
ms_entries.Add(ms_category.CreateEntry(ModSetting.Model.ToString(), ms_modelVisibility));
ms_entries.Add(ms_category.CreateEntry(ModSetting.Mode.ToString(), (int)ms_trackingMode));
ms_entries.Add(ms_category.CreateEntry(ModSetting.Angle.ToString(), 0));
ms_entries.Add(ms_category.CreateEntry(ModSetting.AngleX.ToString(), 0));
ms_entries.Add(ms_category.CreateEntry(ModSetting.AngleY.ToString(), 0));
ms_entries.Add(ms_category.CreateEntry(ModSetting.AngleZ.ToString(), 0));
ms_entries.Add(ms_category.CreateEntry(ModSetting.Head.ToString(), ms_headAttach));
ms_entries.Add(ms_category.CreateEntry(ModSetting.HeadX.ToString(), 0));
ms_entries.Add(ms_category.CreateEntry(ModSetting.HeadY.ToString(), -30));
@ -113,7 +117,11 @@ namespace ml_lme
ms_fingersOnly = (bool)ms_entries[(int)ModSetting.FingersOnly].BoxedValue;
ms_modelVisibility = (bool)ms_entries[(int)ModSetting.Model].BoxedValue;
ms_trackingMode = (LeapTrackingMode)(int)ms_entries[(int)ModSetting.Mode].BoxedValue;
ms_rootAngle = (int)ms_entries[(int)ModSetting.Angle].BoxedValue;
ms_rootAngle = new Vector3(
(int)ms_entries[(int)ModSetting.AngleX].BoxedValue,
(int)ms_entries[(int)ModSetting.AngleY].BoxedValue,
(int)ms_entries[(int)ModSetting.AngleZ].BoxedValue
);
ms_headAttach = (bool)ms_entries[(int)ModSetting.Head].BoxedValue;
ms_headOffset = new Vector3(
(int)ms_entries[(int)ModSetting.HeadX].BoxedValue,
@ -193,9 +201,23 @@ namespace ml_lme
}
break;
case ModSetting.Angle:
case ModSetting.AngleX:
{
ms_rootAngle = int.Parse(p_value);
ms_rootAngle.x = int.Parse(p_value);
RootAngleChange?.Invoke(ms_rootAngle);
}
break;
case ModSetting.AngleY:
{
ms_rootAngle.y = int.Parse(p_value);
RootAngleChange?.Invoke(ms_rootAngle);
}
break;
case ModSetting.AngleZ:
{
ms_rootAngle.z = int.Parse(p_value);
RootAngleChange?.Invoke(ms_rootAngle);
}
break;
@ -262,7 +284,7 @@ namespace ml_lme
{
get => ms_trackingMode;
}
public static float RootAngle
public static Vector3 RootAngle
{
get => ms_rootAngle;
}

View file

@ -344,9 +344,23 @@ function inp_dropdown_mod_lme(_obj, _callbackName) {
</div>
<div class ="row-wrapper">
<div class ="option-caption">Offset angle: </div>
<div class ="option-caption">Offset angle X: </div>
<div class ="option-input">
<div id="Angle" class ="inp_slider no-scroll" data-min="-180" data-max="180" data-current="0"></div>
<div id="AngleX" class ="inp_slider no-scroll" data-min="-180" data-max="180" data-current="0"></div>
</div>
</div>
<div class ="row-wrapper">
<div class ="option-caption">Offset angle Y: </div>
<div class ="option-input">
<div id="AngleY" class ="inp_slider no-scroll" data-min="-180" data-max="180" data-current="0"></div>
</div>
</div>
<div class ="row-wrapper">
<div class ="option-caption">Offset angle Z: </div>
<div class ="option-input">
<div id="AngleZ" class ="inp_slider no-scroll" data-min="-180" data-max="180" data-current="0"></div>
</div>
</div>