fix(physics): restore retail path-6 collision response

This commit is contained in:
Erik 2026-07-31 13:44:55 +02:00
parent acec33eca8
commit 75b6f6b6c9
8 changed files with 523 additions and 223 deletions

View file

@ -2036,23 +2036,6 @@ internal static class FlatBspQuery
Vector3 worldNormal0 = LocalToWorld(
tree.PolygonTable.Polygons[defaultHitPolygonIndex0].Plane.Normal);
if (worldNormal0.Z < PhysicsGlobals.FloorZ)
{
Vector3 currentWorld =
path.GlobalCurrCenter[0].Origin;
Vector3 endWorld =
path.GlobalSphere[0].Origin;
Vector3 globalDelta = endWorld - currentWorld;
float difference = Vector3.Dot(worldNormal0, globalDelta);
if (difference < 0f)
path.AddOffsetToCheckPos(-worldNormal0 * difference);
collisions.SetCollisionNormal(worldNormal0);
collisions.SetSlidingNormal(worldNormal0);
RecordDiagnosticHit(tree, defaultHitPolygonIndex0);
return TransitionState.Slid;
}
path.SetCollide(worldNormal0);
path.WalkableAllowance = PhysicsGlobals.LandingZ;
RecordDiagnosticHit(tree, defaultHitPolygonIndex0);
@ -2075,28 +2058,9 @@ internal static class FlatBspQuery
{
Vector3 worldNormal1 = LocalToWorld(
tree.PolygonTable.Polygons[defaultHitPolygonIndex1].Plane.Normal);
if (worldNormal1.Z < PhysicsGlobals.FloorZ)
{
Vector3 currentWorld =
path.GlobalCurrCenter[0].Origin;
Vector3 endWorld =
path.GlobalSphere[0].Origin;
Vector3 globalDelta = endWorld - currentWorld;
float difference =
Vector3.Dot(worldNormal1, globalDelta);
if (difference < 0f)
path.AddOffsetToCheckPos(-worldNormal1 * difference);
collisions.SetCollisionNormal(worldNormal1);
collisions.SetSlidingNormal(worldNormal1);
RecordDiagnosticHit(tree, defaultHitPolygonIndex1);
return TransitionState.Slid;
}
path.SetCollide(worldNormal1);
path.WalkableAllowance = PhysicsGlobals.LandingZ;
collisions.SetCollisionNormal(worldNormal1);
RecordDiagnosticHit(tree, defaultHitPolygonIndex1);
return TransitionState.Adjusted;
return TransitionState.Collided;
}
}