Fix missiles passing through medistation#3291
Conversation
Fixes Unvanquished#3275: pointAgainstWorld missiles could pass through the medistation on their initial trace. This was caused by an incorrect comparison to decide if the CONTENTS_SOLID or CONTENTS_BODY trace went further. Probably a regression in ab59025
|
This doesn't fix the issue on my end (tested with blaster and prifle, dll sgame). |
Really? I tested the branch again and can't reproduce the issue with either weapon. |
| } | ||
| else | ||
| { | ||
| trace2_t trBody = G_Trace2(ent->r.currentOrigin, ent->r.mins, ent->r.maxs, trWorld.endpos, |
There was a problem hiding this comment.
The first trace goes the entire length from ent->r.currentOrigin to origin. The second trace goes only up to trWorld.endpos, making it shorter in the bugged case. Thus the two trace fractions can't be directly compared and the ternary below is broken.
Changing the endpoint of this trace to origin fixes the issue.
What is the purpose of pointAgainstWorld in the first place?
There was a problem hiding this comment.
Changing the endpoint of this trace to
originfixes the issue.
Sure, making both traces use the same endpoint would be another way to fix it.
What is the purpose of
pointAgainstWorldin the first place?
It makes the missile use a point trace against map geometry (CONTENTS_SOLID) but a finite sized box trace against CONTENTS_BODY entities.
There was a problem hiding this comment.
It makes the missile use a point trace against map geometry (CONTENTS_SOLID) but a finite sized box trace against CONTENTS_BODY entities.
Oh, that makes sense, thanks.
Sure, making both traces use the same endpoint would be another way to fix it.
It's the fix. Comparing fractions from completely different traces doesn't make any sense. Your code is still bugged.
There was a problem hiding this comment.
With the proposed change there is no longer a comparison of two fractions. Only the comparison of a fraction with 1.0.
There was a problem hiding this comment.
You're right, my bad.
I tested your branch (rebased on top of v0.55.3) and everything works fine. I can't reproduce Reaper's issue. I tried both DLL and nexe.
See #3275