- Home /
Enemy pick and throw an object
I've spent the last hour trying to find a way to do the above, but I'm having no luck. What I'm trying to do is the following:
The game is a static scene, the player can move and enemies rush to the screen and shoot at him. Much like the old arcade games like house of the dead and Time Crisis. I've got my player being able to shoot at the enemies, and I've enemies that move around and shoot at the player.
What I want now, is to have one type of enemy that will pick up objects that are fired by the player and throw them back. For example, if my player was throw fire a box at an enemy, miss him, then the enemy would pick it up and throw it back.
I'm wanting to know how to go about this and how other people have done it before. Any help with this would be appreciated.
Answer by Maulik2208 · Nov 28, 2012 at 11:10 AM
First of all make prefabs of the objects Which are used as projectile and then use vector3.distance to find the distance between the special(Throwing things back)enemy and if it is less(means the shoot by player is missed) then Apply the prfab of the object as a projectile of the special enemy.......Good Luck.....
And IF this Works good for you then don't forget to checkbox of Right answer to be ticked......sorry for the bad english.....Enjoy
Your answer
![](https://koobas.hobune.stream/wayback/20220613084629im_/https://answers.unity.com/themes/thub/images/avi.jpg)