Hello there,
I am currently trying to figure out how I can make my 2D player distinguish interactable objects from each other.
What I have now is an NPC where the player can go and have a talk but I also have the Godot logo for him to push away when walking against it for a short while.

The NPC is on Collision Layer Mask 2 & the Godot Logo is on Collision Layer Mask 3
The ray cast is only checking for these 2 layers to collide with so that the player body doesn't interrupt.
I did spot that the RayCast2D has the ability to get_collision_mask_bit(int)
But this seems to always turn out to be true when I interact with something
# If the interaction is with a NPC > and the player presses ENTER > Go talk to that NPC
if(m_interactionCast.get_collision_mask_bit(1) && Input.is_action_just_pressed("ui_accept")):
var nameOfNPC = m_interactionCast.get_collider()
print("Start interaction with: ", nameOfNPC.name)
# If the interaction is with a Moveable object > and the player walks against it for X amount of time > Interact with the object
elif(m_interactionCast.get_collision_mask_bit(2) && Input.is_action_just_pressed("ui_accept")):
var nameOfObject = m_interactionCast.get_collider()
print("Player wants to push: ", nameOfObject.name)
It seems that this isn't something asked or known by many so hopefully someone can still help me since I want to prevent the usage of Objects having the same name and all being on the same layer.
Thanks =)