DestructibleMeshComponent handles the segmentation and manipulation of a mesh to create a segmented version of the original.
OnDestructibleMeshCreated
: UnityEvent< DestructibleMeshComponent > |
Event triggered when a destructible mesh is successfully created.
Signature
UnityEvent<DestructibleMeshComponent> OnDestructibleMeshCreated |
OnSegmentationCompleted
: Func< MeshSegmentationResult, MeshSegmentationResult > |
Function delegate that processes the segmentation result.
It can be used to modify the segmentation results before they are instantiated.
Signature
Func<MeshSegmentationResult, MeshSegmentationResult> OnSegmentationCompleted |
GlobalMeshMaterial
: Material
[Get][Set] |
Gets or sets the material used for the mesh.
This material is applied to the mesh segments that are created during the segmentation process.
Signature
Material GlobalMeshMaterial |
ReservedBottom
: float
[Get][Set] |
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.
Signature
float ReservedBottom |
ReservedSegment
: GameObject
[Get] |
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.
Signature
GameObject ReservedSegment |
ReservedTop
: float
[Get][Set] |
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.
Signature
float ReservedTop |
DestroySegment
(
segment
)
|
Cleans up created mesh segments when the component is destroyed or reset.
Signature
void DestroySegment(GameObject segment) Parameters segment: GameObject
The game object associated to the segment to be destroyed.
Returns void |
GetDestructibleMeshSegments
(
segments
)
|
Populates an array with GameObjects representing the destructible mesh segments.
The array should be provided with enough space to hold all segments. see GetDestructibleMeshSegmentsCount.
Signature
void GetDestructibleMeshSegments(GameObject[] segments) Parameters segments: GameObject[]
The array to populate with mesh segment GameObjects.
Returns void |
GetDestructibleMeshSegments< T >
(
segments
)
|
Populates a provided container with GameObjects representing the destructible mesh segments.
The container will be cleared before being populated.
Signature
void GetDestructibleMeshSegments< T >(T segments) Parameters segments: T
The list to populate with mesh segment GameObjects.
Returns void |
GetDestructibleMeshSegmentsCount
()
|
Returns the count of destructible mesh segments currently managed by this component.
Signature
int GetDestructibleMeshSegmentsCount() Returns int
The number of child GameObjects representing mesh segments.
|
SegmentMesh
(
meshPositions
, meshIndices
, segmentationPoints
)
|
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.
Signature
unsafe void SegmentMesh(Vector3[] meshPositions, uint[] meshIndices, Vector3[] segmentationPoints) Parameters meshPositions: Vector3[]
Array of mesh vertex positions.
meshIndices: uint[]
Array of mesh indices.
segmentationPoints: Vector3[]
Array of points used for segmenting the mesh.
Returns unsafe void |
indices
: int[] |
Signature
int [] indices |
positions
: Vector3[] |
Signature
Vector3 [] positions |
tangents
: Vector4[] |
Signature
Vector4 [] tangents |
uv
: Vector2[] |
Signature
Vector2 [] uv |
reservedSegment
: MeshSegment |
Signature
MeshSegment reservedSegment |
segments
: List< MeshSegment > |
Signature
List<MeshSegment> segments |