How can I make my character walk up a tiny ledge?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Myself(Me)

I would like my character to walk over this ledge just by walking in to it.
Slopes are not an option, what should I do?

:bust_in_silhouette: Reply From: Zylo_X

Hello
i think there is a way to do this but i don’t know if there is a better way

you can put raycast2D in the front of the player at the bottom ( make it very short ray)
and make this ray detect the wall ( so body is tilemap)

make a function with this code in

if $raycast2D.is_colliding():
	velocity.y -= 90 # you can try smaller number see the acceptable number for you

if you are using godot 3.x you should multiply the number by delta and pass delta in the function like this

func tiny_jump(delta) :
 if $raycast2D.is_colliding():
    velocity.y -= 90* delta

and i think instead of using raycast you can try if is_on_wall():

func tiny_jump(delta):
	if is_on_wall():
		velocity.y -=20*delta

then call the function in _physics_process (delta)