So I am making ADAS aka Advance Driver Assistance System, and I am using raycast as it is the most efficient way to script one.
I want it to detect pedestrians and vehicles. My issue now is that I am unable to identify if the detected part is a humanoid or vehicle despite the raycast being able to detect anything. As I am separating pedestrians warning and vehicle collision, I need them the detect each separately and activate a beep sound. I have tried to use this script which is below this paragraph but it did not work out.
EDIT: I am new to raycasting so I may not know the basics. I also find the new method confusing and difficult to understand so I used this method instead.