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