Attention | Topic was automatically imported from the old Question2Answer platform. | |
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?
Attention | Topic was automatically imported from the old Question2Answer platform. | |
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?
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)