API reference
API reference
Select your platform
No SDKs available
No versions available

DestructibleMeshComponent Class

Extends MonoBehaviour
The DestructibleMeshComponent handles the segmentation and manipulation of a mesh to create a segmented version of the original.
Used mainly to build destructible environments in conjunction with a global mesh. For mor details on its usage see DestructibleGlobalMeshSpawner It uses asynchronous tasks to perform the computations for mesh segmentation based on specified parameters and reserved areas.

Fields

Event triggered when a destructible mesh is successfully created.
Function delegate that processes the segmentation result.
It can be used to modify the segmentation results before they are instantiated.

Properties

Gets or sets the material used for the mesh.
This material is applied to the mesh segments that are created during the segmentation process.
Gets or sets the reserved space at the top of the mesh.
This space is not included in the destructible area, allowing for controlled segmentation.
Gets or sets the reserved space at the bottom of the mesh.
TThis space is not included in the destructible area, allowing for controlled segmentation.
Gets the game object associated to the reserved segment defined as the portion of the mesh that should be indestructible.
Can be null if no segment has been reserved.

Member Functions

Initiates the mesh segmentation process asynchronously based on the provided mesh positions, indices, and segmentation points.
It uses native functions to perform the segmentation and updates the mesh accordingly.
Parameters
meshPositions
Array of mesh vertex positions.
meshIndices
Array of mesh indices.
segmentationPoints
Array of points used for segmenting the mesh.
Returns the count of destructible mesh segments currently managed by this component.
Returns
The number of child GameObjects representing mesh segments.
Populates a provided container with GameObjects representing the destructible mesh segments.
The container will be cleared before being populated.
Others
T
The type of the list to populate, must implement IList<GameObject>.
Parameters
segments
The list to populate with mesh segment GameObjects.
Populates an array with GameObjects representing the destructible mesh segments.
The array should be provided with enough space to hold all segments. see GetDestructibleMeshSegmentsCount.
Parameters
segments
The array to populate with mesh segment GameObjects.
Cleans up created mesh segments when the component is destroyed or reset.
Parameters
segment
The game object associated to the segment to be destroyed.
Did you find this page helpful?
Thumbs up icon
Thumbs down icon