Closed Jeff425 closed 1 year ago
I don’t think we should change the meaning of the grounded
flag to add some special-case. Instead, we could add another flag is_sliding_down_slope
that would be set to true
in the case you are describing.
Oh yeah that works as a more generic solution. I'll update the issue
@Jeff425 Would you mind turning your solution into a lovely pull request?
We're suffering from the same issue in our jumping logic, basically a player in our game should only be able to jump if they're grounded and if they're not sliding down a slope.
Yes I will do that today
Why is this an issue? The KinematicCharacterController has a field min_slope_slide_angle that when set, it should make entities that are on steeper slopes to slide down. While the handle_slopes function here https://github.com/dimforge/rapier/blob/c85a833d3a2e4c66024627a9745f033fbbee283a/src/control/character_controller.rs#L475 does do that, it does not send any information to the consumer that it is sliding down a slope. As a consumer, there needs to be a way to know if an entity is currently sliding down a slope in order to maintain things like gravity acceleration.
Potential fix: Add an extra boolean flag such as
is_sliding_down_slope
to the KinematicCharacterControllerOutput when https://github.com/dimforge/rapier/blob/c85a833d3a2e4c66024627a9745f033fbbee283a/src/control/character_controller.rs#L498 is reached.