Fracture

A fracture is a type of asset that let you predefine how a Mesh will break, crack or shatter. The process is done using a two-phase process. First, you need to define the FractureType you want to use; once the parameters and settings are set you need to generate slices by calling the BuildSlices function.

The second step consists of building a series of chunks causing the Mesh to be cut by the slices defined in the previous step. To create these chunks use the BuildChunks function.

Once this process is done the chunks can be saved and converted to shards (a PhysicObject created internally for each chunk) when the Fracture is connected to a FracturedMesh creating a destructible Object.

At runtime collisions applied on the FracturedMesh will cause theses shards to break, crack and/or shattered in real-time.

See Also

Static Variables


Name Description
asset Parent Asset where the active Fracture data is located.
mesh The active Mesh connected to the Fracture.
chunk_count The current amount of chunks generated.
settings Current FractureSettings that determines how the connected Mesh will be fractured.

Variables


Name Description
revision Current revision of the Fracture that internally trigger an update.
options Bit mask of FractureOptions that are currently applied to the Fracture.
fracture_type Active FractureType used by the Fracture.

Functions


Name Description
SetMesh Connect a Mesh to the active Fracture.
ClearSlices Destroy all existing FractureSlice.
CleanSlices Clear up the FractureSlice cache.
BuildSlices Build new slices using the active settings.
ClearChunks Destroy all chunks.
SetChunkOptions Assign a set of FractureChunkOptions to a specific chunk.
GetChunkOptions Retrieve the FractureChunkOptions assigned to a specific chunk.
BuildChunks Use the active slices to cut and generate chunks.

FractureOptions


List of all option flags that can be affected by the Fracture that will be used by the editor and the chunks generator.

  • fDisplayChunks: Toggle the visibility of the slices in the viewport on or off.
  • fDisplayCore: Visualize the core Mesh representation in the 3d viewport.
  • fResolveHoles: Resolve and patch holes based on the topology of the shell used for slicing.
  • fImproveTriangulation: Allow you to select which triangulator to use; either if this flag is off the default one will be used; else a slower but more accurate triangulator will be used to generate the slices.

FractureChunkOptions


Options that can be affected by each and every chunks independently.

  • fDestructable: Determine whether or not the corresponding shard should be treated as a static object (which is indestructible).
  • fSupport: Tells the system that if this shard gets activated (or its constraint is broken) all upper-level shards resting on top of it should get activated.
  • fHole: Do not generate a shard for this chunk.

FractureType


The list of slice types; a visual representation of each and every fracture type can be found in the following manual help section: Fractured Mesh Slices.

  • kManual: Allows you to manually select and place existing mesh(es) that will be used to slice the base mesh during the generation process.
  • kVoronoi: Best way to simulate rocks, ice, glass-like shattering. Using this type you can allocate control points (either manually or randomly) that will then be converted into a tri-dimensional Voronoi cell.
  • kPlanes: Creates precise or noisy cuts by using planes.
  • kChips: This type of slice allows you to simulate dents, pucks and/or broken pieces using flat or noisy cuboids.

FractureSettings


Settings allowing you to access parameter for the active FractureType of the Fracture and setup the slice's configuration.

Static Variables


Name Description
manual Access the ManualFracture settings; nil if the FractureType is not kManual.
voronoi Access the VoronoiFracture settings; nil if the FractureType is not kVoronoi.
planes Access the PlanesFracture settings; nil if the FractureType is not kPlanes.
chips Access the ChipsFracture settings; nil if the FractureType is not kChips.

Variables


Name Description
shell_scale Allows you to control the scale of the shell around the Mesh.
core_mesh Optional core mesh asset id that will be placed at the center of the fractured mesh.
core_transform Local transformation to offset and adjust the core Mesh.
selection_index Internal slice index selection used by the editor to modify a slice parameters.

ManualFracture


A structure that holds parameters to set up kManual slices. When dealing with manual slices, you will have to provide and place all the shape manually. The following API allows you to set which shape should be used for each slot and specify their local transformation (location, rotation, and scale).

Variables


Name Description
shape_count Total amount of shapes that can be used by the manual fracture type.

Functions


Name Description
SetShape Assign an existing Geometry to an existing shape slot.
GetLocation Retrieve the active location set to a specific shape slot.
SetLocation Set the location of a shape using its index as key.
GetRotation Retrieve the active rotation of a shape slot.
SetRotation Set the rotation of a shape using its index as key.
GetScale Retrieve the active scale assigned to a specific shape slot.
SetScale Set the scale of a shape using its index as key.

VoronoiFracture


Contains the settings of a kVoronoi fracture type. Using this type of fracture you will have to set points (either manually or randomly) inside a shell. Once ready theses point will be turned into Voronoi cells that will then be turned into chunks.

Variables


Name Description
point_spread The spread type you want to use; 0 for random, else the spread need to be manually set.
point_count Controls the maximum amount of control points.
shell_bounds Specify the type of envelope (as CollisionBounds) that will be used to generate the cells.

Functions


Name Description
GetPoint Return the location of a specific control point.
SetPoint Set the location of a specific control point.

PlanesFracture


Parameters available when the FractureType is set to kPlanes. Using this type of fracture you will need to place cutting planes; either manually, evenly or randomly, around the Mesh connected to the Fracture. For best results ensure that each plane fully intersects the geometry.

Variables


Name Description
plane_spread Specify the spread type to place the planes.
subdiv Controls the general amount of subdivision apply on all planes.
noise Set the density of the noise that should be applied randomly all planes.
distribution Specify the amount of planes that should be placed on each axis.
random_rotation Randomize the rotation of the planes.
rotation_range Set the random rotational range in degree that should affect the planes.
plane_count Total amount of planes to used to slice up the base Mesh.

Functions


Name Description
GetLocation Return the location of a specific plane.
SetLocation Manually specify the location of a plane using its index as key.
GetRotation Return the current rotation of a specific plane.
SetRotation Manually specify the rotation of a plane by using its index.
GetScale Return the scale of a specific plane.
SetScale Manually specify the scale of a plane using its index as key.
GetParam Return the amount of noise (X) and the number of subdivision (Y) for a plane.
SetParam Tweak the amount of noise and subdivision a plane.

ChipsFracture


A kChips FractureType is very similar to a ChipsFracture at the exception that instead of dealing with chips you will be dealing with cuboids.

Variables


Name Description
chip_spread Specify the way the chips should be placed around the Mesh connected to the Fracture.
subdiv Controls the general amount of subdivision to be applied on all chips.
noise Controls the density of the noise that to randomly apply on all chips.
distribution The chips distribution factor on each axis.
random_rotation Enable rotation randomization for each chips.
rotation_range Rotational range in degree that should affect the chips.
random_scale Enable scale randomization for each chips.
scale_range Rotational range in degree that should affect the chips.
chip_count Total amount of chips to place around the base Mesh.

Functions


Name Description
GetLocation Get the location of a specific chip.
SetLocation Set the location of a chip by index.
GetRotation Return the current rotation of a chip.
SetRotation Manually set the rotation of a chip.
GetScale Return the scale value used by a chip.
SetScale Tweak the scale of a specific chip.
GetParam Get the amount of noise and subdivisions (XY) of a chip.
SetParam Tweak the amount of noise and subdivision a chip.

FractureSlice


Structure that contain the transformation and geometric information of an individual fracture slice.

Static Variables


Name Description
geometry Geometry information for the active slice.

Variables


Name Description
local_matrix Local 4x4 transformation matrix of the slice.




NRG - API 2022.4.384543 - Fri Nov 4 2022
Copyright © 2022 nrgcore.com. All Rights Reserved. Terms of Service - Privacy Policy - EULA