0 votes

So I'm using the 2.2 alpha version of Godot and fiddling with moveandslide for a kinematic character, but I'm having issues with movement along slopes.

I notice the demo just uses a constant FLOORNORMAL Vector2(0,-1). I figured maybe I could do a getcollisionnormal() to replace the FLOORNORMAL, but that didn't seem to work out too well. I set up a state machine to print out the current state and sure enough, it's constantly switching between "ground" and "air" so long as I'm moving on the slope.

Is there an easy way to fix this so I stay on the "ground" when going uphill/downhill? Gravity is already set decently high (around 3000), which comes with its own issues so I'd rather not make that any higher.

Preferably, I'd like to avoid using a bunch of raycasts to detect collision sideways and beneath in order to set specific x and y velocities.

asked Jan 11 in Engine by Fishtail (19 points)

I'm still struggling with slopes with and without moveandslide with a fixed speed...

Going down in steep slopes is my bigger problem, maybe limiting the x speed when the normal is at an angle > PI or when the remaining Y motion is too big.

But a raycast may be unavoidable to get floor normal when going down (mostly to slow X and prevent the starting jump that ruins all the movement).


In the github demo project, there is a platformer demo that uses moveandslide and almost solves slope issues, i think because the controller does something like an accelerated movement.


Remember that moveandslide is still a work in progress, I don't know if it will suffer some changes or even if will be added to Godot 3.

Please log in or register to answer this question.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.