0 votes

the player seems to teleport as my object goes left and right. How can I move the object more smoothly when it is moving?


extends KinematicBody
var v = Vector3()
func physicsprocess(delta):
v = Vector3()
if Input.isactionjustpressed("a"):
v += transform.basis.x
if Input.is
actionjustpressed("d"):
v -= transform.basis.x
moveandcollide(v * 5)
Godot version 3.2.3
in Engine by (60 points)

1 Answer

0 votes

Have you tried factoring in delta? That is, in this part of the code?

move_and_collide(v * 5 * delta)
by (2,848 points)

When you do as you said, the object does not go 5 units. do you have any other ideas?

That's just how delta time works, try increasing the speed so that it goes at what looks to you is 5 units per frame

For example moveandcollide(v * 150 * delta)

And no im not exagerating with 150, delta is usually a very small value so you use a relatively high speed value

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.