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

Fix character not sliding on slopes when stop_on_slopes is false. #99731

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

yosoyfreeman
Copy link

Allows the character to slide on the floor as a result of downwards vertical velocity if stop_on_slopes is set to false.

Fixes 83673

The change is very small, as the issue was that stop_on_slopes was simply not being used at all when handling sliding on slopes.

TODO:
-Check if the same problem exist in 2D and implement the same fix.

Pre PR:
stop_on_slopes has no effect at all on stopping on slopes.

2024-11-27.00-53-52.mp4

Post PR:

The character slides as expected.

2024-11-27.00-50-10.mp4

NOTES:

Q: Why the character was sliding a super tiny bit if we didn't had the functionality in the first place?
A: Because p_cancel_sliding is used wrong in various places (Similar case to #99397), I hope to address that soon.

MPR:

stop_on_slopes_fix.zip

@yosoyfreeman yosoyfreeman requested review from a team as code owners November 26, 2024 23:58
@smix8 smix8 added this to the 4.x milestone Nov 27, 2024
@yosoyfreeman
Copy link
Author

Hi there! I been testing this as thoroughly as i can to make sure there are no compatibility issues.

Right now, the fix works quite well, and produces a very natural result. However, it can cause (correctly) the body to get some upwards direction as a consequence of sliding with the floor. Not a bug, but doesn't follow the design philosophy of the whole CharacterBody (No vertical input, no vertical output)

I'm working on testing a couple different ways to approach the same thing while respecting that rule, even if that results in somewhat of a less natural slide, as i understand that right now we have to focus ourselves on fixing errors in the current algorithm, not to change the behavior itself.

I'll update this as soon as i can with the news and test results. I may be over cautious but i really want this to feel like it was there from the beginning, to work in a similar fashion to our current approach (For better or worse) and that it can't cause any kind of regressions.

@AThousandShips AThousandShips changed the title Fixes character not sliding on slopes when <stop_on_slopes> is false. Fixes character not sliding on slopes when stop_on_slopes is false. Nov 27, 2024
@AThousandShips AThousandShips changed the title Fixes character not sliding on slopes when stop_on_slopes is false. Fix character not sliding on slopes when stop_on_slopes is false. Nov 29, 2024
…rds motion,

as per already stablished conventions on the algorithm.
@yosoyfreeman
Copy link
Author

Updated the PR to prevent the floor sliding from adding vertical motion to the body. As i said, bit less natural, but more coherent with the whole thing.

Videos:

2024-11-30.12-32-11.mp4
2024-11-30.12-32-34.mp4

As you can see the lack of #99731 causes some instability in the body. That pr fixes bodies with stop_on_slopes from attempting to re-snap to things is already close enough.

@yosoyfreeman yosoyfreeman requested a review from a team as a code owner November 30, 2024 11:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

CharacterBody3D will not slide on slopes when stop on slopes is disabled.
2 participants