This commit is contained in:
2026-07-07 20:51:18 -07:00
parent d2203c8aa1
commit cc2e7ad95e
20 changed files with 794 additions and 35 deletions
@@ -104,13 +104,16 @@ namespace ProjectM.Tests
Assert.AreEqual(0f, slid.y, Eps);
}
[Test]
public void SlideVelocity_DegenerateNormal_ReturnsInput()
public void SlideVelocity_DegenerateNormal_DeflectsToTangent()
{
// A degenerate (zero / near-vertical) normal has no defined slide plane. The mover must NOT keep driving
// straight into the wall (the enemy-stuck-on-cover-rock bug) -> it deflects to a horizontal tangent of the
// motion (a 90 deg turn about Y: (x,0,z) -> (-z,0,x)) so it glances AROUND the obstacle.
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);
Assert.AreEqual(-v.z, slid.x, Eps);
Assert.AreEqual(v.x, slid.z, Eps);
Assert.AreEqual(0f, slid.y, Eps);
}
// ---- EB-1 fortress aggro: PickWeightedNearest ----