diff --git a/Engines/FlatRedBallXNA/FlatRedBall/ExtensionMethods/Vector2ExtensionMethods.cs b/Engines/FlatRedBallXNA/FlatRedBall/ExtensionMethods/Vector2ExtensionMethods.cs
index a646ea0eb..4be34900c 100644
--- a/Engines/FlatRedBallXNA/FlatRedBall/ExtensionMethods/Vector2ExtensionMethods.cs
+++ b/Engines/FlatRedBallXNA/FlatRedBall/ExtensionMethods/Vector2ExtensionMethods.cs
@@ -117,16 +117,29 @@ public static Vector2 RotatedBy(this Vector2 vector2, float radiansToRotateBy)
}
}
+ ///
+ /// Returns a unit vector pointing in the direction specified by the radians argument.
+ ///
+ /// The direction in radians, where 0 is to the right, and values
+ /// increase counterclockwise.
+ ///
public static Vector2 FromAngle(float angleRadians)
{
return new Vector2((float)Math.Cos(angleRadians),
(float)Math.Sin(angleRadians));
}
+ ///
+ /// Returns a unit vector pointing in the direction specified by the degrees argument.
+ ///
+ /// The direction in degrees, where 0 is to the right, and values
+ /// increasing counterclockwise.
+ ///
public static Vector2 FromAngleDegrees(float angleDegrees)
{
var angleRadians = MathHelper.ToRadians(angleDegrees);
- return new Vector2((float)Math.Cos(angleRadians),
+ return new Vector2(
+ (float)Math.Cos(angleRadians),
(float)Math.Sin(angleRadians));
}
diff --git a/Engines/FlatRedBallXNA/FlatRedBall/ExtensionMethods/Vector3ExtensionMethods.cs b/Engines/FlatRedBallXNA/FlatRedBall/ExtensionMethods/Vector3ExtensionMethods.cs
index e56402dd6..7379eb004 100644
--- a/Engines/FlatRedBallXNA/FlatRedBall/ExtensionMethods/Vector3ExtensionMethods.cs
+++ b/Engines/FlatRedBallXNA/FlatRedBall/ExtensionMethods/Vector3ExtensionMethods.cs
@@ -160,7 +160,7 @@ public static Vector3 RotatedBy(this Vector3 vector3, float radiansToRotateBy)
///
/// Returns a unit vector with a Z value of 0 pointing in the direction
- /// specified by the radians value.
+ /// specified by the radians argument.
///
/// The direction in radians, where 0 is to the right, and
/// values increase counterclockwise.
@@ -174,6 +174,23 @@ public static Vector3 FromAngle(float radians)
);
}
+ ///
+ /// Returns a unit vector with a Z value of 0 pointing in the direction
+ /// specified by the degrees argument.
+ ///
+ /// The direction in angles, where 0 is to the right, and
+ /// values increase counterclockwise.
+ /// A new Vector3 pointing in the desired direction.
+ public static Vector3 FromAngleDegrees(float angleDegrees)
+ {
+ var radians = MathHelper.ToRadians(angleDegrees);
+ return new Vector3(
+ (float)Math.Cos(radians),
+ (float)Math.Sin(radians),
+ 0
+ );
+ }
+
///
/// Returns a vector in the same direction as the argument vector, but of the length specified by the length argument.
/// This can safely be called on vectors with length 0, as the right direction will be used.