0 votes

I am a beginner coder and I was able to code everything I wanted until I had to code a function that moves a body to a position in expected time. For example I want my body to go Vector2(100, -100) from Vector2(0, 0) in 10 seconds. This one really stumped me. I'm not asking for an entire code that I could copy and paste, I only want an idea of how I could accomplish it. I know so little about physics and such.

in Engine by (20 points)

1 Answer

0 votes

Use division. (Vector2(0, 0) - Vector2(100, -100)) / 10 seconds is Vector2(-10, 10) per second. That is your velocity vector. Put it into move and slide.

by (4,476 points)
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.

Categories