- Home /
Make grenade apply force to rigidbodies around it
Okay, so I have a grenade script that works fine, but I would like to make it apply force to rigidbodies around it when it explodes. For example, if I throw it at a bunch of crates, I want it to make them fly away when it explodes. How can I do this? Thanks
Answer by flaviusxvii · May 24, 2011 at 09:31 PM
Actually im not. Ive been looking it up, but havent been able to find it.
Answer by Peter G · May 25, 2011 at 01:28 AM
Here's the documentation page on it. It would be fairly straight forward to adjust this to your needs. I made a script somewhere for exponential fall off, I think it was on the forums. If I can find it I'll link to it as well.
Found it. I think the math on this page is correct for an exponential fall off.
The final force = defaultForce * falloff ^ -distFromBlast
Answer by JoshDangIt · Aug 16, 2016 at 03:18 PM
Use Physics.OverlapSphere and make a loop that applies force to every rigidbody it hit.
Your answer
Follow this Question
Related Questions
Decrease ExplosionForce and damage continously by distance 2 Answers
Exploide GameObjects Into BrokenParts : Unity 1 Answer
How to calculate force from explosion on a rigidbody 1 Answer
How to apply a radial force 2 Answers
AddExplosionForce 0 Answers