How can I make an Area2D detect a RayCast2D?

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

I can make the raycast2d detect the area but not the other way around.
Having the area detect the raycast would save me some braincells so any ideas u have just drop them here please!

:bust_in_silhouette: Reply From: timothybrentwood

RayCasts can’t be detected since they don’t have a Collision Layer. Adding an object that can be detected as the parent of the RayCast is probably the solution you’re looking for.

:bust_in_silhouette: Reply From: nah

the area2d can listen to the raycast detecting things. then check if it’s him who was detected. it should be equivalent to the area detecting the raycast.