Now, this is more complicated than it sounds.
I have made some simple destructible objects, and when i shoot and break them, i want all the fragments in one area to be pushed back.
Here’s my destruction script:
And here’s my idea:
This is my one of my destructible objects (glass):
And when i shoot a point (blue) i want the objects in the area around it to be pushed back (red).
How i do this? Thanks!
Hi! I did something similar recently - it’s actually pretty straight forward, once you got it. Take the position of the hit and perform a OverlapSphere() to get an array of all nearby colliders. Get their Rigidbodys (GetComponent()) and AddExplosionForce() while usind the projectile as the forces origin.
To improve the effect, scale down the affected fragments a little bit (like 5%), so they can fall out better. If you want them to get pushed further back and not sideways, add an empty GameObject to the Projectile, being behind the actual projectile and use this as the forces origin.