Skip to content

Fix ray/cylinder trace dropping some actor hits - #322

Merged
dpjudas merged 1 commit into
dpjudas:masterfrom
Farantir:fix-cylinder-trace-endcaps
Aug 15, 2026
Merged

Fix ray/cylinder trace dropping some actor hits#322
dpjudas merged 1 commit into
dpjudas:masterfrom
Farantir:fix-cylinder-trace-endcaps

Conversation

@Farantir

Copy link
Copy Markdown

this fixes the broken catwalk bug in vortex rikers. The problem here where 2 blockall actors that where not properly identifyed as colliders

RayCylinderTrace mishandled three cases, which between them lost 51% of the
hits it should have reported (measured against an analytic swept-point-vs-
cylinder reference over 3M random rays):

- The endcap picked in the validRoots == 0 branch was inverted. Rl is measured
  from cb, the bottom cap, so Ca_dot_Rl <= 0 means the ray starts below the
  cylinder, but the code traced the top cap, and vice versa. That branch never
  returned a correct answer.

- validRoots == 1 assigned d0 = t1 where it meant d0 = d1, comparing against a
  cylinder root instead of the disc distance it had just computed. This broke
  anything entering through the bottom cap.

- A ray parallel to the cylinder axis makes both a and b exactly zero, so
  GetQuadraticRoots computed 0/0. Such a ray can only cross the endcaps, so
  handle it directly instead of solving the quadratic. This also covers a ray
  whose origin starts vertically embedded in the cylinder, which the existing
  endcap fallback did not.

Also fixes an operator precedence slip in the near-tangent branch of
GetQuadraticRoots, where -(b / 2.0 * a) computed -a*b/2 instead of -b/(2a).

The failures concentrated on wide, flat actors and on steep rays, so the most
visible symptom was pawns falling straight through large BlockAll actors: the
one at (-1135.2, -458.5, 199.0) in Vortex2 has CollisionRadius 200 and
CollisionHeight 32, and a pawn dropped onto it passed through to the floor
below instead of landing on top of it. Angled hitscan and projectile traces
against pawns went through the same branches.
@dpjudas
dpjudas merged commit 7b83c6e into dpjudas:master Aug 15, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants