Slopes clipping velocity?

Godot Version

4.2.1

Question

For some reason the velocity of my units is clipped at low velocities whenever they’re going up slopes. They use move_and_slide() and the velocity is determined by the code:


Where LEGS_SPEED_CURRENT is the velocity and LEGS_TURN_CURRENT is the direction the unit is moving.
I’ve made a gif demonstrating the issue:
slopes

Any ideas?

yeah the gravity is pulling it down at the same time you are moving up. I too would like a solution here.

1 Like

I worked on this before I did get something working for me. I had an area node in front of the character, at the feet. When the terrain was in the area I turned off the gravity for the character. And then when it was not in the area, I turned gravity back on.

Oh and one more thing. A ray cast works better than an Area, sorry for that.

Do you have ‘Constant Speed’ enabled in the CharacterBody3D’s properties?

I do, here is the CharacterBody3D parameters if that helps.
cb3s

You seem to be right about this. I think I ran into a similar problem while working on an FPS prototype a while ago, where the character body making contact with a wall caused it to clip the entire movement vector. I had fixed this by taking the dot product of the wall normal with the velocity, multiplying it by the wall normal and then subtracting that from the velocity. May have to do something like that here, will post back if figure anything out.

I didn’t figure out anything from my previous thought, but I followed yours by only applying the gravity addition if the units is_grounded flag is false and that has fixed the issue. Thanks for your insight!