I'm setting the y velocity of a rigidbody to zero and it's still falling?

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

Pretty much the title.

Here’s the code:

func _physics_process(delta):
    linear_velocity.y = 0;

What should I do to cancel this ghost movement?

Have you tried using the Axis Lock property in the RigidBody inspector?

Calinou | 2022-08-28 16:14

:bust_in_silhouette: Reply From: Inces

Aside of your physics process() rigid bodies runs its physics under the hood. It conflicts with your code, but gravity still pushes movement forward a little, despite freezing velocity every frame. Just set the gravity to 0