-
Notifications
You must be signed in to change notification settings - Fork 2k
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
LocalPlayer: Fix sneaking on nodes with large collisionboxes #12626
LocalPlayer: Fix sneaking on nodes with large collisionboxes #12626
Conversation
6bc88b4
to
0d9b69c
Compare
bool LocalPlayer::updateSneakNode(Map *map, const v3f &position, | ||
const v3f &sneak_max) | ||
{ | ||
// Acceptable distance to node center | ||
constexpr f32 allowed_range = (0.5f + 0.1f) * BS; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems pretty hardcoded and arbitrary to me
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I could've as well changed nothing and nobody would ever notice or complain.
It's good as is and should be kept like that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would at least annotate this as a hack. The "allowed range" should be based on nodebox extent.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
setting it to nodebox extent = no range checking = the bug seen in OP issue
at least with the current code structure
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I still notice some issues when sneaking on the janky nodes:
- When sneaking onto a janky node whose plane is vertical, my point of view sometimes gets snapped into a different position, suddenly moving horizontally.
- When I am on a janky node whose plane is horizontal and I start sneaking then walk off the edge, nothing stops my movement.
These things occur with or without the sneak glitch enabled.
@TurkeyMcMac Could you please provide an image of what nodes you tested? Preferably with testing code, if it is different to what's already provided in the issue. Is this a regression or behaviour that already exists in master? |
The fix for the first issue is to use the distance between the player and node collision box (using the nearest manhattan point). Currently I am using the center point of each the nodeboxes for simplcity. However I cannot think of a trivial implementation to fix this issue, as it would also have to be repeated for each node in range, making the code slower than it already is. As of issue 2, I don't think I will address it in this PR and delay for later. |
Alright, it's good to have this fix anyway. |
0d9b69c
to
9acf451
Compare
This seems to break auto-jump. Never mind. I'm an idiot. |
Fixes #12612 by taking the nodebox extent center into account.
To do
This PR is Ready for Review.
How to test