0 votes

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?

in Engine by (16 points)

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.

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.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.