Skip to content

Commit 91b7a59

Browse files
committed
Fix shoulders being pulled too far forward
1 parent a9b4fab commit 91b7a59

File tree

1 file changed

+2
-9
lines changed

1 file changed

+2
-9
lines changed

Source/CustomAvatar/Avatar/CustomIKSolverVR.cs

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -263,15 +263,6 @@ internal static void Solve(Arm arm, bool isLeft)
263263
IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions)
264264
{
265265
return new CodeMatcher(instructions)
266-
// Add `+ yOA` after `Mathf.Atan2(sDirWorking.x, sDirWorking.z) * Mathf.Rad2Deg`
267-
.MatchForward(true,
268-
new CodeMatch(i => i.Equals(OpCodes.Ldc_R4, Mathf.Rad2Deg)),
269-
new CodeMatch(OpCodes.Mul))
270-
.ThrowIfInvalid("Initial yaw calculation not found")
271-
.Advance(1)
272-
.InsertAndAdvance(
273-
new CodeInstruction(OpCodes.Ldloc_2),
274-
new CodeInstruction(OpCodes.Add))
275266
// Remove `yaw -= yOA`
276267
.MatchForward(false,
277268
new CodeMatch(i => i.LoadsLocal(5)),
@@ -284,11 +275,13 @@ IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instruction
284275
.MatchForward(false,
285276
new CodeMatch(OpCodes.Ldloc_2),
286277
new CodeMatch(OpCodes.Sub))
278+
.ThrowIfInvalid("`yawLimitMin - yOA` not found")
287279
.RemoveInstructions(2)
288280
// Remove `- yOA` from `yawLimitMax` in call to `DamperValue`
289281
.MatchForward(false,
290282
new CodeMatch(OpCodes.Ldloc_2),
291283
new CodeMatch(OpCodes.Sub))
284+
.ThrowIfInvalid("`yawLimitMax - yOA` not found")
292285
.RemoveInstructions(2)
293286
// Replace `shoulder.solverRotation * shoulder.axis` with `From(this, isLeft)`
294287
.MatchForward(false,

0 commit comments

Comments
 (0)