Detect collision in rigid body(character)

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

Hi, I need your help, until now I cant solve this… When I use rigid body as character I cant get the collider name just appears as array and I don know how to set a collision condition using this array this appears as [RigidBody2D:671] do you know something about this? Or if you know other way to det collision in character mode that could be useful

:bust_in_silhouette: Reply From: Gokudomatic2

get_colliding_bodies() return an array of objects, in case more than one object touches the body. If you want the name of the first one, simply get the object like for a normal array:

var bodies=get_colliding_bodies()
print(bodies[0].get_name())