Awesome
Mesh Fragmentation
Fragment a mesh and simulate an explosion. Live demo here.
Usage
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 radiusMinConeRadius
andMaxConeRadius
. Both cones use the mainSpreadDirection
Quantity
: [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 theSpreadForce
MaxForace
: Max value used to generate a random scale applied to theSpreadForce
DebugColor
: Color used in the scene view
Quick overview
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.