Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add rampbugfix to CKZ #88

Merged
merged 6 commits into from
Jan 19, 2024
Merged

Add rampbugfix to CKZ #88

merged 6 commits into from
Jan 19, 2024

Conversation

zer0k-z
Copy link
Collaborator

@zer0k-z zer0k-z commented Jan 14, 2024

Addresses #62.
In CS2, rampbug happens when there's a slope that gets in our way. It's tiny, and will send you way off the ramp once you collide with it.
The solution is to keep track of the previous valid plane, then we move the trace along the previous normal (or in 26 different directions if this normal fails) to see if we can dodge this mini ramp.

If we happen to hit a plane, check if it's a plane that will potentially knock you away still. If it's not a valid plane, we keep moving away from the original plane.

If we moved really far yet we still couldn't dodge it, that means the ramp is sufficiently big and is most likely a legitimate ramp. In that case, we don't do anything.

And if we don't hit anything, trace back to the original end point. Some scenarios can happen:

  1. The most common case is that the parallel trace will hit a legitimate ramp. We make sure the trace is valid, move the player there, and clip the velocity according to the normal that we just got.
  2. It's possible that the parallel trace hits nothing. Then we can just move the player straight to the original end spot, no velocity clipping needed.
  3. In very unlikely cases, the parallel trace will not hit anything, but tracing back to the original end will make the trace hit the invalid plane again. The current fix doesn't do anything about this yet, but in theory we could just extend the original end (and therefore the parallel traces) to get out of this situation and either end back up in 1 and 2 again.

@zer0k-z zer0k-z merged commit e0dde41 into dev Jan 19, 2024
10 checks passed
@zer0k-z zer0k-z deleted the ckz-rampbug branch January 19, 2024 21:21
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.

None yet

1 participant