Fix ray/cylinder trace dropping some actor hits - #322
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
this fixes the broken catwalk bug in vortex rikers. The problem here where 2 blockall actors that where not properly identifyed as colliders