get_collider() doesn't work

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By AquilaHeliaca
:warning: Old Version Published before Godot 3 was released.

Hi
I have another problem. I try to check if player collides with object above him. I try to use function get_collider() but variable object is still empty after calling this function. Besides debugger shows “Child Process Connected”. When get_collider is called, there is an error: “Condition !colliding is true. returned: 0”. Why it doesn’t working?

    if is_colliding():
	 var normal = get_collision_normal()
	 var finalMov = normal.slide(movRemainder)	
	 move(finalMov)
	
	 if normal == Vector2(0,1):
		object = get_collider()

Ofc i declared object variable before and script extends KinematicBody2D. Function is_collide() works properly.

:bust_in_silhouette: Reply From: eons

The error says that “not is_colliding is true” (meaning is not colliding) when you try to retrieve a collider.

After move, you need to check if is_colliding if you want to get a collider, and you are using move again in that code.