Fragment a mesh and simulate an explosion. Live demo here.
Put the MeshExplosion MonoBehaviour on a GameObject with a Mesh. Configure the explosion:
SpreadDirection: The direction of the spread (in world space)Gravity: The gravity acceleration (down in world space)SpreadForce: The spread force (with a mass of 1). How fast fragments are spreadDuration: The length of the animation in secondsDrag: How fast the fragments are slowed downMinAngularVelocity: Min value used to generate a random rotation of the fragmentsMaxAngularVelocity: Max value used to generate a random rotation of the fragmentsSpreadings: Set of spreading configuration. The spreading goes between two cones of radiusMinConeRadiusandMaxConeRadius. Both cones use the mainSpreadDirectionQuantity: [0..1] percentage of fragments using this spreading configurationMinConeRadius: First cone radiusMaxConeRadius: Second cone radiusConeRingDistance: The length of the cone. Low value sets a wide spreading. High value sets a narrow spreading.MinForce: Min value used to generate a random scale applied to theSpreadForceMaxForace: Max value used to generate a random scale applied to theSpreadForceDebugColor: Color used in the scene view
The MeshFragmenting class splits the mesh into fragments (it make sure each triangle has its own vertices).
The MeshExplosion class animates the fragments over time.


