kinematicBody move_and_slide move to wrong side

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Edgar Vakhitov

Hello, sorry for dummy question but cannot figure out why it does not work.

So I have RayCast2D, where I take collision point via:

teleport_dest = ray.get_collision_point()

Then I am trying to move my player to this point with code:

var x = move_toward(position.x, teleport_dest.x, delta)
var y = move_toward(position.y, teleport_dest.y, delta)
move_and_slide(Vector2(x, y))

But it move player complitly do different way. What I am doing in wrong way?

I’m pretty new to Godot as well so I don’t know if this will help, but I do know that in Godot, up is the negative y direction, and down is the positive y direction. So maybe you just need to add some negatives to make it go the other way.

Taurenzine | 2020-03-30 17:46