Apply this component to any game object you wish to fracture while running in game mode. Runtime fractures will produce a unique set of pieces with each fracture. However, this is at the cost of computational time. It is recommended that both the piece count and poly count are kept low. This component is most effective when FractureRadius is set to a value in-between 0 and 1. More...
Public Attributes | |
bool | Asynchronous = true |
If true, the fracture operation is performed on a background thread and may not be finished by the time the fracture call returns. A couple of frames can go by from the time of the fracture to when the pieces are ready. If this is false, the fracture will guaranteed be complete by the end of the call, but the game will be paused while the fractures are being created. | |
Public Attributes inherited from DinoFracture.FractureGeometry | |
Material | InsideMaterial |
The material assigned to the “inside” triangles of the fracture pieces. These are the triangles that DinoFracture creates. The surface triangles of the original mesh retain their materials. | |
bool | OptimizeMaterialUsage = true |
If true, newly generated triangles using the "InsideMaterial" will attempt to be part of the same existing material in th mesh. | |
GameObject | FractureTemplate |
This game object will be cloned for each facture piece. It is required to have a MeshFilter component. If a MeshCollider component is added, it will be assigned the fracture mesh. | |
Transform | PiecesParent |
The parent of the generated pieces. Each fracture produces a root object with fracture pieces (clones of FractureTemplate) as children. The root object is parented to PiecesParent. | |
FractureType | FractureType = FractureType.Shatter |
The type of fracture to produce when Fracture() is called. | |
SlicePlaneSerializable[] | SlicePlanes |
The planes to use when slicing the mesh. Not used when fracturing into pieces. | |
int | NumFracturePieces = 5 |
The number of fracture pieces generated per iteration. Fault lines are spread evenly around the fracture point. The number of total pieces generated is NumFracturePieces ^ NumIterations. | |
int | NumIterations = 2 |
The number of passes of fracturing. Using lower piece count with a higher iteration count is computationally faster than a higher piece count with a lower iteration count. Ex: 5 pieces with 2 iterations is faster than 25 pieces and 1 iteration. The downside to using more iterations is fractures can become less uniform. In general, keep this number below 4. The number of total pieces generated is NumFracturePieces ^ NumIterations. | |
bool | EvenlySizedPieces = true |
If true, the engine will attempt to make all the randomly generated pieces roughly the same size. This adds a little processing time to the fracture. | |
int | NumGenerations = 1 |
To allow for fracture pieces to be further fractured, the FractureTemplate should have a FractureGeometry component. NumGenerations dictates how many times the geometry can be re-fractured. The count is decremented and passed on to the component in each generated piece. Ex: A value of 2 means this piece can be fractured and each generated piece can be fractured. The second generation of fractures cannot be fractured further. | |
float | FractureRadius |
A value between 0 and 1 that indicates how clustered the fracture lines are. A value of 0 or 1 means fractures are evenly distributed across the mesh. A value between means they are clustered within a percentage of the mesh bounds. Ex: a value of 0.3 means fractures are clustered around the fracture point in a volume 30% the size of the mesh. Pre-fracture geometry typically has this value set to 0 or 1 because there isn’t always a pre-determined point of fracture. | |
SizeSerializable | FractureSize |
The approximate size of fractures to create during shatter. When combined with a position through a call to Fracture(), the shatter planes will be clustered within this bounds. | |
FractureUVScale | UVScale = FractureUVScale.Piece |
If set to EntireMesh, the UV map for each inside triangle will be mapped to a box the size of the original mesh. If set to piece, inside triangles will be mapped to a box the size of the individual fracture piece. | |
UVBoundsSerializable | UVBounds = new UVBoundsSerializable(Vector2.zero, Vector2.one) |
Final 'inside' triangles will be remapped to be within this range. This does not affect the UVs on the incoming mesh and works with any value set for the UVScale. | |
bool | DistributeMass = true |
If true and both this game object and the FractureTemplate have a RigidBody component, each fracture piece will have a mass set to a value proportional to its volume. That is, the density of the fracture piece will equal the density of the original mesh. If false, the mass property goes untouched. | |
bool | SeparateDisjointPieces = false |
If true, a final pass will be done to separate out meshes that are not physically connected. This can only happen when the mesh has concave parts. | |
VertexMergingPolicy | VertexMergingPolicy = VertexMergingPolicy.Default |
Defines how aggressively to merge the vertices of this fracture. More aggressive merging will result in meshes that have a reduced number of vertices and triangles at the cost of more computation time during fracture. | |
int | RandomSeed = 0 |
The random seed to use when initiating the fracture. If set to zero, then the system clock will be used to create a random seed. | |
OnFractureEvent | OnFractureCompleted |
Unity event that fires whenever a fracture on this object completes. | |
bool | SkipMeshCleaning = false |
Not recommended to be set. But if set to true, no mesh cleaning will occur during the fracture process. This has no effect if the mesh is already clean. | |
Additional Inherited Members | |
Public Member Functions inherited from DinoFracture.FractureGeometry | |
void | FractureAndForget () |
Initiate a fracture at the origin and does not return a handle to the async operation. | |
void | FractureAndForget (Vector3 localPos) |
Initiate a fracture at the specified position relative to this object and does not return a handle to the async operation. | |
AsyncFractureResult | Fracture () |
Initiate a fracture at the origin. | |
AsyncFractureResult | Fracture (Vector3 localPos) |
Initiate a fracture at the specified position relative to this object. | |
OnFractureEventArgs | CreateEmptyFractureEventArgs () |
Creates an empty set of OnFractureEventArgs that can be used to manually fracture completed handler in the event that calling Fracture() returns no async fracture result to attach to. | |
MeshTopologyError | CheckMeshValidity () |
This is called automatically when viewing the component in the inspector. However, it should be called whenever the mesh changes through other means. | |
void | ForceValidGeometry () |
This will force the geometry to pass all validity checks. | |
List< EdgeError > | GetMeshEdgeErrors () |
Returns any bad mesh edges. Used by the editor script for debugging. | |
Static Public Member Functions inherited from DinoFracture.FractureGeometry | |
static SlicePlaneSerializable | CreateSlicePlane (Plane worldPlane, Transform targetGameObject) |
This will create a valid slice plane for slicing a mesh. | |
Properties inherited from DinoFracture.FractureGeometry | |
MeshValidity | MeshValidity [get] |
Used to determine if the mesh is of known good quality to fracture. | |
bool | IsProcessingFracture [get] |
Are we in the middle of computing a fracture for this object? | |
Apply this component to any game object you wish to fracture while running in game mode. Runtime fractures will produce a unique set of pieces with each fracture. However, this is at the cost of computational time. It is recommended that both the piece count and poly count are kept low. This component is most effective when FractureRadius is set to a value in-between 0 and 1.
bool DinoFracture.RuntimeFracturedGeometry.Asynchronous = true |
If true, the fracture operation is performed on a background thread and may not be finished by the time the fracture call returns. A couple of frames can go by from the time of the fracture to when the pieces are ready. If this is false, the fracture will guaranteed be complete by the end of the call, but the game will be paused while the fractures are being created.
It is recommended to set asynchronous to true whenever possible.