HUD and Height Changes

This commit is contained in:
2026-06-07 22:29:25 -07:00
parent 4ebaba9933
commit 1ed2aa46c5
41 changed files with 24787 additions and 766 deletions
@@ -75,5 +75,41 @@ namespace ProjectM.Tests
var other = EnemyAIMath.RingPosition(c, 2, 8, 4f);
Assert.Greater(math.distance(a, other), 1e-3f);
}
[Test]
public void SlideVelocity_RemovesIntoWallComponent()
{
// Moving +X into a wall whose normal is -X (facing the mover): the into-wall component is removed.
var slid = EnemyAIMath.SlideVelocity(new float3(4, 0, 0), new float3(-1, 0, 0));
Assert.AreEqual(0f, math.length(slid), Eps);
}
[Test]
public void SlideVelocity_KeepsParallelComponent()
{
// Moving diagonally into a wall with normal -X: the +X part is clipped, the +Z part survives.
var slid = EnemyAIMath.SlideVelocity(new float3(3, 0, 5), new float3(-1, 0, 0));
Assert.AreEqual(0f, slid.x, Eps);
Assert.AreEqual(5f, slid.z, Eps);
Assert.AreEqual(0f, slid.y, Eps);
}
[Test]
public void SlideVelocity_FlattensNormalToPlane()
{
// A normal with a Y tilt is flattened to XZ before projecting, so vertical tilt never leaks in.
var slid = EnemyAIMath.SlideVelocity(new float3(2, 0, 0), new float3(-1, 5, 0));
Assert.AreEqual(0f, slid.x, Eps);
Assert.AreEqual(0f, slid.y, Eps);
}
[Test]
public void SlideVelocity_DegenerateNormal_ReturnsInput()
{
var v = new float3(2, 0, 3);
var slid = EnemyAIMath.SlideVelocity(v, float3.zero);
Assert.AreEqual(v.x, slid.x, Eps);
Assert.AreEqual(v.z, slid.z, Eps);
}
}
}