- Home /
How to make raycast go through various colliders
HI there...!! well i realy need help with this plz...!!!
so the things is that i want to raycast and that ray get me all colliders that the ray go through.
Imagine you have 2 sphere colliders, a sphere inside a sphere, so one in center with the tag core and the other the bigger one called shield, and when i raycast lets say i just want for now Debug.log(); the tag the collider have on console so the console out put will be:
shield. core.
and etc if there were other colliders in the raycast trayectory.
plz guys help me with this...!! what i try to achive is to identify where my player got hit so the player have a mesh collider but to know where the bullet hit like arm, leg, body, head etc. i would like to use a trigger, or if some one out there got another idea on how to know on where part of the body the bullet hip pla make me know...!!!
Answer by fafase · Nov 30, 2013 at 06:28 PM
I guess this should do it:
https://docs.unity3d.com/Documentation/ScriptReference/Physics.RaycastAll.html