Godot 4 CharacterBody3D MoveAndSlide() jittering and getting stuck (Game breaking)

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By dezboyle

The new CharacterBody3D gets stuck or starts vibrating if it collides with any irregular surface using MoveAndSlide (move_and_slide). I didn’t catch this bug until I was very invested in the project because all of my test levels were grayboxed with simple geometry (90deg angles, primitive boxes)

Video

I also tested this with this example project to see if my script / project was at fault, but I had the same issue https://godotengine.org/asset-library/asset/1519

If someone knows a workaround / alternative, I’m desperate.

I don’t want to downgrade to Godot 3.0 and have to re-write all of my netcode, which I already tediously translated from the 3.0 docs… and then translated to C#

Is your character using cylinder collision by any chance? If so, try switching to capsule shape. I had a lot of problems specifically with the cylinder collision getting stuck at arbitrary places.

I’m currently using capsule collision for the player, and tri-mesh collision for most of the world environment/terrain, and it is stable enough for my use case. Also note that collision accuracy will degrade the further away from the origin point you get. From my testing, human-sized collisions start to get jittery/occasionally stuck when more than 1000-2000 units away from the origin.

Ninfur | 2022-11-09 07:05

I’m using a capsule currently and I have tried every other possible collision shape, but they all have the same problem. Its close to the origin point as well.

Would you mind sending a screenshot of your character controller setup?

dezboyle | 2022-11-09 07:19

it’s over a year later, and i’m hunting down a solution to a similar problem. my player-driven main sprite is using move_and_slide, and my test NPC sprite is also using move_and_slide. the moment my main sprite collides with the NPC sprite, it ‘bonds’ with the other sprite, and jitters as the pair now attempt to move in unison across the map… :confused: