Hello there guys,
I have a question about raycasts and layers. Is it possible to make it so that if you shoot a wall with a raycast the bullets/raycast passes through the wall if it has a specific layer/tag and then can hit a player standing behind it? I know I could set a layer which get ignored by the raycast BUT... Is it possible that you can make it so that a bullethole and a hitparticle gets instantiated at the point the raycast enters the passable collider?
Btw. I know how to make raycasts, hitcolliders and bulletholes so ther is no need to explain that.
Pretty sure there is no other solution than to cast multiple Rays. Use the RaycastHit class to find out where you want to instantiate bulletholes. Maybe you want to consider writing your own Raycast function that has a parameter for the number of hits and returns an array with z-sorted contacts. (basically a function that calls two or more Physics.Raycast())
answered Jun 11 '12 at 02:28 PM