Skip to content

Comments

Fix missiles passing through medistation#3291

Merged
slipher merged 2 commits intoUnvanquished:masterfrom
slipher:misfix
May 13, 2025
Merged

Fix missiles passing through medistation#3291
slipher merged 2 commits intoUnvanquished:masterfrom
slipher:misfix

Conversation

@slipher
Copy link
Contributor

@slipher slipher commented Jan 10, 2025

See #3275

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
@VReaperV
Copy link
Contributor

This doesn't fix the issue on my end (tested with blaster and prifle, dll sgame).

@slipher
Copy link
Contributor Author

slipher commented Jan 17, 2025

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.

@VReaperV
Copy link
Contributor

}
else
{
trace2_t trBody = G_Trace2(ent->r.currentOrigin, ent->r.mins, ent->r.maxs, trWorld.endpos,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changing the endpoint of this trace to origin fixes the issue.

Sure, making both traces use the same endpoint would be another way to fix it.

What is the purpose of pointAgainstWorld in 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.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With the proposed change there is no longer a comparison of two fractions. Only the comparison of a fraction with 1.0.

Copy link
Contributor

@enneract enneract May 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@slipher slipher merged commit 401ea8b into Unvanquished:master May 13, 2025
9 checks passed
@slipher slipher deleted the misfix branch May 13, 2025 07:23
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.

3 participants