how to detect player variations in one collision

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Visni

hi, i have a question, i have a scene called door, when the player collides with the door, my code verify if is the player, if is the player the script change the scene, but i was implementing a skin system that use scenes as prefabs, but now i can’t use the old code, idk how to explain, im not a native english speaker, i guess my code will explain better:

func _physics_process(delta):
var bodies = get_overlapping_bodies()
for body in bodies:
	if "Player" in body.get_name():
		if Globals.isDark == true:
			get_tree().change_scene(world_scene)
		else:
			get_tree().reload_current_scene()
	
pass

like, i need to check only if is “player” in the name of the scene but this code doesn’t work

:bust_in_silhouette: Reply From: mdubaisi

you can use collision layers and collision masks

maybe it will help you