Hi, im trying to make a turret script that detects players through raycasting. I got the raycast part working, but how do I make the raycast ignore certain objects with certain tags? The “ignore raycast” layer worked well, but it ignores every raycast made on it by my turret or other stuff like my player. I just want the object to ignore the raycast made by my turret. How do i do this with tags in javascript? Thanks!
Raycasting has layer masks, you can mask layers so they don’t intersect the ray. However, you are asking for tag ingnorance. What comes to my mind is:
You can check the tag of the object that is hit, then if this object has a tag, that should be “ignored” raycast another ray from last ray’s hit point. Haven’t done such thing yet, but if your objects have faces only on the outer side and not on the inside (double faced or whatever’s it called), it shouldn’t be a problem.
Is there no other simpler ways that i can just make the object ignore the raycast?