Skip to content

Commit

Permalink
Merge pull request #29 from ehsan-mohammadi/dev
Browse files Browse the repository at this point in the history
Fix LimitRotation2D
  • Loading branch information
ehsan-mohammadi authored Sep 8, 2019
2 parents ab624be + 4a910b3 commit 5d680f1
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Aim-IK/AimIKBehaviour2D.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ private void CheckClamp(Transform part, AxisLimitRotation limitRotation, float r
{
// Clamp (If activate)
if (limitRotation.active)
rotation = AimIKFunctions.ClampAngle(part.localEulerAngles.z + 90, limitRotation.min, limitRotation.max);
rotation = AimIKFunctions.ClampAngle(part.localEulerAngles.z, limitRotation.min, limitRotation.max);
else
rotation = part.localEulerAngles.z;

Expand All @@ -45,7 +45,7 @@ private void LookAt2D(Transform transform, Vector2 worldPosition)
diff.Normalize();

float rotateZ = Mathf.Atan2(diff.y, diff.x) * Mathf.Rad2Deg;
transform.rotation = Quaternion.Euler(0f, 0f, rotateZ - 90);
transform.rotation = Quaternion.Euler(0f, 0f, rotateZ);
}

/// <summary>
Expand Down

0 comments on commit 5d680f1

Please sign in to comment.