Skip to content
This repository has been archived by the owner on May 15, 2023. It is now read-only.

Commit

Permalink
IKT: removed the option to bring viewpoint drift back
Browse files Browse the repository at this point in the history
  • Loading branch information
knah committed Dec 30, 2021
1 parent 7c9ded0 commit 9ad060a
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 31 deletions.
5 changes: 1 addition & 4 deletions IKTweaks/CustomSpineSolver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -163,10 +163,7 @@ private void SolvePelvis() {
Quaternion.FromToRotation(head.solverPosition - pelvis.solverPosition,
headSolverPosition - IKPositionPelvis));

var deltaHead = headSolverPosition - head.solverPosition;
var deltaHips = IKPositionPelvis - pelvis.solverPosition;
var mix = IkTweaksSettings.GetHeadDriftFactor();
delta = deltaHips * mix + deltaHead * (1f - mix);
delta = headSolverPosition - head.solverPosition;
foreach (VirtualBone bone in bones) bone.solverPosition += delta;

var currentDistance = (head.solverPosition - pelvis.solverPosition).magnitude;
Expand Down
2 changes: 1 addition & 1 deletion IKTweaks/IKTweaks.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<LangVersion>latest</LangVersion>
<VrcReferences>true</VrcReferences>
<AssemblyVersion>1.0.22</AssemblyVersion>
<AssemblyVersion>1.0.23</AssemblyVersion>
</PropertyGroup>
<ItemGroup>
<None Remove="iktweaks" />
Expand Down
6 changes: 1 addition & 5 deletions IKTweaks/IKTweaksMod.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
using Delegate = Il2CppSystem.Delegate;
using Object = UnityEngine.Object;

[assembly:MelonInfo(typeof(IKTweaksMod), "IKTweaks", "1.0.22", "knah", "https://github.com/knah/VRCMods")]
[assembly:MelonInfo(typeof(IKTweaksMod), "IKTweaks", "1.0.23", "knah", "https://github.com/knah/VRCMods")]
[assembly:MelonGame("VRChat", "VRChat")]
[assembly:MelonOptionalDependencies("UIExpansionKit")]

Expand Down Expand Up @@ -137,10 +137,6 @@ private static void AddUixActions()
(nameof(MeasureAvatarMode.ImprovedWingspan), "Wingspan (accurate)"),
(nameof(MeasureAvatarMode.Height), "Height"),
});

var updateVisibility = ExpansionKitApi.RegisterSettingsVisibilityCallback(IkTweaksSettings.IkTweaksCategory,
nameof(IkTweaksSettings.DriftMix), () => IkTweaksSettings.DriftMode.Value == DriftPreference.Custom);
IkTweaksSettings.DriftMode.OnValueChangedUntyped += updateVisibility;
}

private static void ShowIKTweaksMenu()
Expand Down
18 changes: 3 additions & 15 deletions IKTweaks/IkTweaksSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ internal static void RegisterSettings()
OneHandedCalibration = category.CreateEntry(nameof(OneHandedCalibration), false, "One-handed calibration");

NoWallFreeze = category.CreateEntry(nameof(NoWallFreeze), true, "Don't freeze head/hands inside walls");
DriftMode = category.CreateEntry(nameof(DriftMode), DriftPreference.Hips, "Which body part will drift?");
DriftMix = category.CreateEntry(nameof(DriftMix), 0.5f, "Drift mix (0=hips, 1=viewpoint, 0.5=both equally)");

ExperimentalSettingOne = category.CreateEntry(nameof(ExperimentalSettingOne), false, "Experimental setting", dont_save_default: true, is_hidden: true);

HandAngleOffset = category.CreateEntry(nameof(HandAngleOffset), DefaultHandAngle, "Hand angle offset", null, true);
HandPositionOffset = category.CreateEntry(nameof(HandPositionOffset), DefaultHandOffset, "Hand position offset", null, true);
Expand Down Expand Up @@ -118,25 +118,13 @@ private static void UpdateIgnoreAnimationMode(string value)
public static MelonPreferences_Entry<float> WingspanMeasurementAdjustFactor;
public static MelonPreferences_Entry<bool> OneHandedCalibration;
public static MelonPreferences_Entry<bool> NoWallFreeze;
public static MelonPreferences_Entry<DriftPreference> DriftMode;
public static MelonPreferences_Entry<float> DriftMix;
public static MelonPreferences_Entry<bool> ExperimentalSettingOne;

public static MelonPreferences_Entry<Vector3> HandAngleOffset;
public static MelonPreferences_Entry<Vector3> HandPositionOffset;

public static IgnoreAnimationsMode IgnoreAnimationsModeParsed;
public static MeasureAvatarMode MeasureModeParsed;

public static float GetHeadDriftFactor()
{
return DriftMode.Value switch
{
DriftPreference.Hips => 0,
DriftPreference.Viewpoint => 1,
DriftPreference.Custom => DriftMix.Value,
_ => throw new ArgumentOutOfRangeException()
};
}
}

[Flags]
Expand Down
3 changes: 0 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -259,8 +259,6 @@ Given that this mod is still work in progress, these are subject to change.
* Improved wingspan adjustment factor - your wingspan is adjusted by this factor in "Improved wingspan" scaling mode. If you consistently get avatar arms too long/short, consider tweaking this a tiny bit (to like 1.05 or 1.15)
* One-handed calibration - pressing one trigger will be enough to calibrate. Holding the trigger slightly pressed will freeze the avatar (if enabled).
* Don't freeze head/hands inside walls - prevents your hands/head from freezing if your head gets inside a wall.
* Which body part will drift? - in case you want your viewpoint drift back, you monster.
* Drift mix - if the previous setting is set to custom, decides how much viewpoint and hips can drift. 0 means viewpoint/head is fixed to the headset, 1 means hip is fixed to the tracker, values inbetween make both drift in different proportions.
* Hand angles/offsets (found in VRChat Settings menu -> left blue panel -> More IKTweaks -> Adjust hand angles/offsets) - you can configure how avatar hands are positioned relative to controllers. Defaults were tuned for Index controllers, but should be applicable to most other controllers too.

### Partial source code
Expand All @@ -274,7 +272,6 @@ If you want to build the mod yourself, you'll need to do the following:
* Rename `RootMotionNew.FinalIK.IKSolverVR.Leg.ApplyOffsets` to `ApplyOffsetsOld`, remove `override` from it
* Add `ApplyBendGoal();` to the second line of `RootMotionNew.FinalIK.IKSolverVR.Leg.Solve(bool)`
* Rename `Update`, `FixedUpdate` and `LateUpdate` on VRIK_New by adding `_ManualDrive` suffix to them and make them `internal` instead of `private`
* In `IKSolverVR.Solve` comment out `spine.InverseTranslateToHead` in legs section
* Fix compilation if broken

## JoinNotifier
Expand Down
4 changes: 1 addition & 3 deletions ReleaseChangelog.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
Read the [Malicious Mods and you](https://github.com/knah/VRCMods/blob/master/Malicious-Mods.md) doc!

Changes:
* IKTweaks: fix calibration not saving often/recalibrating randomly
* IKTweaks: added detection of AFK state
* IKTweaks: added an option to bring viewpoint drift back
* IKTweaks: removed the option to bring viewpoint drift back as it caused too many issues. It might return someday.


**USE IT AT YOUR OWN RISK.** Modding the client is against VRChat ToS. I am not responsible for any bans or other punishments you may get by using these mods!

0 comments on commit 9ad060a

Please sign in to comment.