From d06cba8263cc7b5a0b59b4d530043c67c1d6abad Mon Sep 17 00:00:00 2001 From: gered Date: Mon, 2 Sep 2013 14:14:25 -0400 Subject: [PATCH] add angle helper method --- Blarg.GameFramework/Math/MathHelpers.cs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/Blarg.GameFramework/Math/MathHelpers.cs b/Blarg.GameFramework/Math/MathHelpers.cs index 15fbf32..e40f4e8 100644 --- a/Blarg.GameFramework/Math/MathHelpers.cs +++ b/Blarg.GameFramework/Math/MathHelpers.cs @@ -86,6 +86,19 @@ namespace Blarg.GameFramework return angle - MathConstants.Radians90; } + /// + /// Returns the angle of rotation around the Y axis between the two + /// 3D points. This is calculated by only looking at the X and Z + /// components of each point. + /// + /// The angle of rotation (in radians) around the Y axis between the two points + /// The first point + /// The second point + public static float GetYAngleBetweenPoints(Vector3 a, Vector3 b) + { + return GetAngleBetweenPoints(a.X, a.Z, b.X, b.Z); + } + /// /// Solves a quadratic equation and returns the lowest root. ///