0 votes

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

in Engine by (91 points)

1 Answer

+2 votes

getcollidingbodies() 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())
by (701 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.