Improve KCC examples and use MoveAndSlide#949
Merged
Merged
Conversation
- Use `MoveAndSlide` - Combine a bunch of components for a more sane split - Make system scheduling more sane
Previously, move-and-slide constantly let objects go past the skin width, and depenetration kicked in. This was causing sliding down slopes due to depenetration!
janhohenheim
approved these changes
Mar 4, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Objective
Fixes #273
#894 implemented the move-and-slide algorithm for building kinematic character controllers. However, our KCC examples don't actually use it yet! To demonstrate how it can be used, and have better KCC examples for Avian, we should update the examples.
Solution
Use
MoveAndSlidefor thekinematic_character_2dandkinematic_character_3dexamples. This involved some tricky bits:on_hitcallback. This is the most complicated part. I partially adapted the logic from Rapier.cast_move; the skin width wasn't considered in the shape castmax_distance, causing the character to move past the skin width, at which point depenetration kicked in, moving the character along the normal, causing drift down the slope. This is now fixed.I also improved the examples in general:
TransformInterpolationPreUpdateand handle movement inFixedUpdateLinearDampingdoesTesting
Ran the examples a bunch of times.
Showcase
kinematic_character_3d2026-03-04.02-09-58.mp4
Previously, the box would fly away as soon as you stand on it or push it into a wall. With move-and-slide and manually applied impulses, this doesn't happen.