- Home /
Make raycast ignore some triggers but hit some others?
I have a script that shoots a ray and if a ray hits a specific trigger it does this or that. The thing is that I want it to hit only some triggers but go through other triggers. I know you can disable ray hit for triggers globally, but what about per-object basis?
Or can I somehow generate a hit on a trigger but still continue the ray until it hits a collider?
Thanks
Answer by almo · May 20, 2011 at 02:41 PM
Looks like you could use this:
http://unity3d.com/support/documentation/ScriptReference/Physics.RaycastAll.html
This will do a raycast through everything, and return all the hits. Then you look for the ones you care about in the results.
Your answer
Follow this Question
Related Questions
Box Collider wont trigger a Trigger after moveing the object 0 Answers
Is there a way to detect if an object is being hit by a raycast? 2 Answers
Don't allow raycasts to go through colliders? 3 Answers
Raycast hits a collider and halts. 1 Answer
I don't know why i can't detect by ray sth. tagged, 1 Answer