- Home /
Raycast grenade?
How can I make a script that casts out rays to all surrounding rigidbodies? I am trying to apply damage.
Answer by robertbu · Mar 29, 2013 at 04:38 AM
See this answer:
http://answers.unity3d.com/questions/423174/bomberman-bombs-using-overlapsphere1st-person.html
The bottom script has a simpler answer which just raycasts from the center of the grenade to the center of the object. The code above that does a more sophisticated raycast from the corners of the renderer bounding box. You will have to make a few changes based on the nature of your game.
Note this code is seeing if an object blocks the grenade. If you just want to find the objects to apply damage, you can use Physics.OverlapSphere().
Your answer
Follow this Question
Related Questions
How to make this script find distance inside radius? 1 Answer
What is the Best way to use Raycast for enemy Fire? 2 Answers
How to completely or partially change an objects model when hit by a raycast in a certain spot 0 Answers
Make grenade doesnt affect anything if it is behind wall 1 Answer
How to damage gameobject via raycast 1 Answer