Anyone Know how to get the name of something you are CURRENTLY colliding with

Godot Version

var body = left.get_overlapping_bodies().name

Question

`Im trying to get the name of something im currently colliding with and the line of code im using to get this info keeps crashing the game HELP

I am not sure, but I think the function you are calling is giving you an array, not a single object. You need to pick out from the array which object you want the name from.

Ohhhhh that makes sense

I’m new so I don’t use those types of functions.

Usually I use the built in signals and then reference what they detect like this:

image

I hope this helps, sorry if that’s not what you were asking.

You could also use node groups, Check if the thing you are colliding with has a group and then you can do whatever based on that

1 Like

Ok that could work