0 votes

So I was trying to make a simple Kinematic2D object move.

My code : https://sourceb.in/88Tscg7KiJ

It works, but I have 2 issues.

  1. Why do I need to use 5000 as a multiplying factor with my normalized vector where the example on the Godot page achieves same smooth motion with 500 ?

  2. Why do I need to put the input checking function in the get input function and call it from there ? I had put the code into the physics process function but the kinematic body did not move then. To my knowledge, the physics process function is called at regular intervals so why can't we check input there ?

Sorry, if these questions are noob-ish, I am a beginner (15min experience in Godot and game dev)

Godot version 3.4
in Engine by (12 points)

1 Answer

0 votes
  1. This probably has to do with your scale. The 500 or 5000 is how much you're scaling your velocity. If your object is large, 5000 pixels/sec is a good speed. If it's small, 500 pixels/sec may be all you want.

  2. You are checking input in the _physics_process() function. Placing the input code in its own function and then calling it from _physics_process() is a matter of keeping the code organized. It is easier to troubleshoot and modify this way than if you had just one giant function with all the code in it.

by (21,718 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 Frequently asked questions and 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 [email protected] with your username.