Why my character jumps on smooth terrain?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Sprowk
:warning: Old Version Published before Godot 3 was released.

I set up RigidBody2D same as platformer demo. Added collision shape like pencil and few sprites.

The problem is when i try to walk on terrain in this picture. My character sometimes jumps in air and lose speed in x direction.

edit: It looks like he is tripping over.

:bust_in_silhouette: Reply From: eons

You will have to adjust the body so it works on your terrain design, maybe a heavier body, or more gravity, or manipulate the forces to stick it on the ground while not jumping.

That is the problem of working with rigid bodies, a lot of tweaking until it feels good.


A simple FSM to control _integrate_forces according to the body state could help to adjust one state without messing up another.

I changed few things and it is a lot better but still rarely it gets stuck. I think I will have to tweak more.

Sprowk | 2017-01-10 21:51

Can you please say what you have tweaked?

dzeroone | 2017-01-11 10:18

@eons I don’t know how to use _integrate_forces, can you please show me a hint?

dzeroone | 2017-01-11 10:23

@dzeroone while using the custom integrator, you’ll have to manipulate the body state (is something of the Physics2DDirectBodyState type), the platformer demo (2D and 3D) is an example.

eons | 2017-01-11 13:02