How to make the raycast detect 1 of the 2 same nodes

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

So for a project im using walls as a Area2D and doing the same for the player, but it detects the same for both, i tried coding the variable for each but it still keeps detecting the same for both. Do i need to be more specific and add names for each node or is it an error with the coding (i mostly think it’s a problem with the coding)

var wall = Area2D
var p = Area2D
if ($RayCast2D.is_colliding()):
:bust_in_silhouette: Reply From: Lopy

You can two Raycasts, one for the player and on for the wall (distinguished using collision masks).

Thanks, that helped me with some problems on the hitboxes!

ItSubCreating | 2021-01-01 18:56