-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add fix for jumpy sliders and joints on headlesses by @LeCloutPanda
Add fix for Yellow-Dog-Man/Resonite-Issues#399 Co-authored-by: LeCloutPanda <53411604+LeCloutPanda@users.noreply.github.com>
- Loading branch information
1 parent
f397060
commit b02a312
Showing
4 changed files
with
62 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
using FrooxEngine; | ||
using HarmonyLib; | ||
using MonkeyLoader.Resonite; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Text; | ||
|
||
// Originally released under MIT by LeCloutPanda here: | ||
// https://github.com/LeCloutPanda/SoNoHeadCrash | ||
|
||
namespace CommunityBugFixCollection | ||
{ | ||
[HarmonyPatch("OnAwake")] | ||
[HarmonyPatchCategory(nameof(SmoothSlidersAndJoints))] | ||
internal sealed class SmoothSlidersAndJoints : ResoniteMonkey<SmoothSlidersAndJoints> | ||
{ | ||
public override IEnumerable<string> Authors => base.Authors; | ||
public override bool CanBeDisabled => true; | ||
|
||
[HarmonyPostfix] | ||
[HarmonyPatch(typeof(Joint))] | ||
public static void JointOnAwakePostfix(Joint __instance) | ||
{ | ||
if (!Enabled || __instance.LocalUser.HeadDevice != HeadOutputDevice.Headless || !__instance.LocalUser.IsHost) | ||
return; | ||
|
||
__instance.RunInUpdates(3, () => | ||
{ | ||
if (__instance.FilterWorldElement() is null) | ||
return; | ||
|
||
__instance.DontDrive.Value = true; | ||
|
||
Logger.Info(() => $"Set DontDrive to true for Joint:"); | ||
Logger.Info(() => __instance.ParentHierarchyToString()); | ||
}); | ||
} | ||
|
||
[HarmonyPostfix] | ||
[HarmonyPatch(typeof(Slider))] | ||
public static void SliderOnAwakePostfix(Slider __instance) | ||
{ | ||
if (!Enabled || __instance.LocalUser.HeadDevice != HeadOutputDevice.Headless || !__instance.LocalUser.IsHost) | ||
return; | ||
|
||
__instance.RunInUpdates(3, () => | ||
{ | ||
if (__instance.FilterWorldElement() is null) | ||
return; | ||
|
||
__instance.DontDrive.Value = true; | ||
|
||
Logger.Info(() => $"Set DontDrive to true for Slider:"); | ||
Logger.Info(() => __instance.ParentHierarchyToString()); | ||
}); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters