|
Hello everyone, I need a lead way or some kind of an explanation about bullet penetration. I simply have a raycast shooting code with damage, it works fine. I want it to penetrate from some objects like wood. I thought a way like this, for example, if hit gameObject has a tag called "wood" ; make a bullet decal on hit position and damage it & continue to search for any other colliders from the same direction, if find any make a decal on it & damage it too. But I couldn't figure out how to do that. Or is there any other logic or explanation about bullet penetration with raycast shooting ? Thanks :)
(comments are locked)
|
|
Use 'RaycastAll'- it returns an array of hits that you can use in this fashion. thanks that works fine :). But another problem occured, it doesn't stop. Is there any way to stop the raycast in if statement ?
May 14 '12 at 08:41 PM
Inan Evin
Yes, RaycastAll has a 'distance' paramater that you can implement- by default it is set to infinity, but you can change that to anything you like. Alternatively, if you don't know the distance before the raycast is shot, you can calculate your desired maximum distance and then simply ignore any that are from further away than that.
May 15 '12 at 02:19 AM
syclamoth
(comments are locked)
|
