Troubleshooting Condition '!body->get_space()' is true. returned: false error

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

I have a projectile that is a KinematicBody2D, which I move by calling move_and_collide() in physics_process().

The projectile seems to randomly throw the following error:

Condition ‘!body->get_space()’ is true. returned: false error

The stack trace points me to this line in my code, which is in physics_process():

var collision = move_and_collide(vel * delta)

The error doesn’t cause the game to crash, but I would still like to fix it.

I don’t see the error every time I spawn a projectile, only sometimes.

Even if I remove the projectile from all collision layers and disable all its collision masks, I still see this error.

The only other physics objects in my scene are my Player (which is also a KinematicBody2D) and a TileMap (which has collision).

What could be causing this error?

I am working in Godot 3.0.6.