HUD and Height Changes
This commit is contained in:
@@ -35,6 +35,24 @@ namespace ProjectM.Simulation
|
||||
d.y = 0f;
|
||||
return math.lengthsq(d) <= range * range;
|
||||
}
|
||||
/// <summary>
|
||||
/// Projects a planar movement <paramref name="vel"/> onto a wall plane defined by <paramref name="surfaceNormal"/>
|
||||
/// (collide-and-slide): removes the component of <paramref name="vel"/> that pushes into the surface so the
|
||||
/// mover glances along the wall instead of stopping dead. Both inputs are flattened to the XZ plane (top-down).
|
||||
/// Returns <paramref name="vel"/> unchanged when the normal is degenerate.
|
||||
/// </summary>
|
||||
public static float3 SlideVelocity(float3 vel, float3 surfaceNormal)
|
||||
{
|
||||
surfaceNormal.y = 0f;
|
||||
float len = math.length(surfaceNormal);
|
||||
if (len < 1e-6f)
|
||||
return vel;
|
||||
float3 n = surfaceNormal / len;
|
||||
float3 slid = vel - math.dot(vel, n) * n;
|
||||
slid.y = 0f;
|
||||
return slid;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Deterministic planar ring position around <paramref name="center"/> for spawn
|
||||
|
||||
Reference in New Issue
Block a user