The Godot Q&A is currently undergoing maintenance!

Your ability to ask and answer questions is temporarily disabled. You can browse existing threads in read-only mode.

We are working on bringing this community platform back to its full functionality, stay tuned for updates.

godotengine.org | Twitter

+2 votes

Sometimes, when I start my game, at the very beginning, this error pops up:

0:00:00:0484 - Condition ' !body->get_space() ' is true. returned: false
----------
Type:Error
Description: 
Time: 0:00:00:0484
C Error: Condition ' !body->get_space() ' is true. returned: false
C Source: servers/physics_2d/physics_2d_server_sw.cpp:969
C Function: body_test_motion

I don't know if it's a bug or something I'm doing wrong. Here is the segment of code where the error points out, in the move_and_slide function calling:

func _physics_process(delta):
direction = 0
if Input.is_action_pressed("ui_left"):
    direction -= 1
if Input.is_action_pressed("ui_right"):
    direction += 1

speed_current.x = lerp(speed_current.x, WALK_MAX_SPEED * direction,
        SPEED_STEP)

if is_on_floor() and Input.is_action_just_pressed("ui_up"):
    speed_current.y = JUMP_FORCE

speed_current.y += GRAVITY * delta

speed_remaining = move_and_slide(speed_current, FLOOR_NORMAL)
speed_current.y = speed_remaining.y
if not is_on_floor():
    speed_current.x = speed_remaining.x

if is_on_floor() and position.y < camera.get_camera_position().y:
    camera.drag_margin_top = 0
elif camera.drag_margin_top == 0:
    camera.drag_margin_top = CAMERA_TOP_MARGIN
in Engine by (80 points)

Ever figure out what the issue was?

Hell, I stopped working on the project that this code was from since a good time. I actually don't know.

I just got this error myself. AFAI can tell, it's from trying to spawn a physics body in a place where it can't be spawned, i.e colliding.

The reason i think this is because I got the error from spawning a large amount of kinematic 2d bodies into a relatively small space. The game crashed, and like I say, I think its from them not having room to be created without colliding with what's alreay there.

2 Answers

0 votes

i've got this error when restarting current scene few times. Still don't know how fix this.

by (77 points)
+1 vote

i got the same problem when i try to add a kinemoditybody2d to my scene, the error happend when the kinemoditybody2d call the moveandslide and the linearvelocity that passed in is zero(only once),i updated the code to call the moveand_slide only when the velocity is not zero and the error solved
sorry my english is not good

by (16 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.