|
ok ive been working on my sniper today, and successfully having it in a beta working state(it needs more work) it dawned on me that the raycast im using doesnt carry on through the enemy so to hit another enemy. if any of you have ever played cod, most of you will have, is there anyway such way to achieve collateral damage? thanks :)
(comments are locked)
|
|
Just use RaycastAll instead of Raycast to get info about all objects in line of the shot instead of only the first. Edit: a working example. I advice Raycast over collision detection of bullets anyway, because if they move fast it may not register. Raycast is a lot more reliable. I'm assuming all players are tagged player here.
Now you could improve this script to for instance place a bullethole texture on the target[x].point if the target is a wall, etc. Good luck with it! thanks i think raycastall will do the trick, ive not tried it out but i will let you know when i do :)
May 09 '11 at 10:36 PM
Samir 1
I'll edit in an example :)
May 10 '11 at 06:33 AM
Joshua
thanks man much appreciated :)
May 12 '11 at 04:18 PM
Samir 1
i get an erroe saying array index is out of range?
May 12 '11 at 04:33 PM
Samir 1
First check if there is a first and then second collider, and then call them.
May 12 '11 at 11:40 PM
Joshua
(comments are locked)
|
|
Try to set your enemy as isTrigger, then tell it either to destroy the bullet or let the bullet go and only decrease the lifepoints of the enemy. Not sure if this works though, just trying to think with you. :)
(comments are locked)
|
|
You could try an OnTriggerEnter() that makes a raycast out the back of the enemy at the same angle as the one going into him.
(comments are locked)
|
