Fixes falling though map when using charge on a hill.

This commit is contained in:
hondacrx
2022-07-20 01:39:25 -04:00
parent 1ae937efe5
commit 17f3eab338
6 changed files with 15 additions and 8 deletions
+8 -1
View File
@@ -241,9 +241,16 @@ namespace System
return a;
}
public static Vector3 direction(this Vector3 vector)
{
float lenSquared = vector.LengthSquared();
float invSqrt = 1.0f / MathF.Sqrt(lenSquared);
return new Vector3(vector.X * invSqrt, vector.Y * invSqrt, vector.Z * invSqrt);
}
public static Vector3 directionOrZero(this Vector3 vector)
{
float mag = vector.Length();
float mag = vector.LengthSquared();
if (mag < 0.0000001f)
{
return Vector3.Zero;