11 / 16
Packages/2D Destruction Pro/Fragment ratios & ancestry
CUT DURING GAMEPLAY
11 / 16

Fragment ratios & ancestry

Use polygon area, original/parent ratios and current-cycle fragment identities.

English guideSource: Unity 6000.3.13f1 · Optional Jobs / BurstWeb edition · 21 October 2026

Area follows polygon geometry#

Area comes from generated solid polygon area in source-sprite local space. It is not a bounding-box estimate, and texture alpha is not sampled.

Transparent pixels inside Full Rect Sprite geometry still count as geometry. A tight/custom outline excludes its empty exterior. Choose source geometry deliberately when area drives scoring or gameplay rules.

Original ratio and parent ratio#

PropertyCalculationQuestion answered
OriginalRatioFragment area / original source polygon area.How much of the original source is this piece?
ParentRatioFragment area / immediate parent polygon area.How much of the piece just cut is this child?

For the guide's example, a first cut produces A = 30% and B = 70% of the original. Cutting B produces B1 = 25% and B2 = 45% of the original:

PieceOriginalRatioParentRatio
A0.300.30 on the first cut.
B0.700.70 on the first cut.
B10.2525 / 70 ≈ 0.357.
B20.4545 / 70 ≈ 0.643.

The child ratios answer different questions, so preserve both when your gameplay needs original-source scoring and immediate-parent split balance.

Track a current ancestry tree#

Fragment metadata exposes FragmentId, ParentFragmentId, OriginalSourceId, Generation, Area and Bounds. Use TryGetRuntimeFragment and TryGetParent to resolve current-cycle ancestry.

Detailed results also provide world CutPosition, source-local LocalPosition, NormalizedSpritePosition, CutDirection and line endpoints. These can support feedback, sound or scoring tied to the actual cut.

Read the returned fragments#

This contextual guide snippet assumes target, worldStart and worldEnd are supplied by your component:

C#
RuntimeSliceResult result = target.SliceSegmentDetailed(worldStart, worldEnd, force: 2f);
if (result.Success)
{
    foreach (RuntimeFragmentInfo fragment in result.Fragments)
        Debug.Log($"Original {fragment.OriginalRatio:P1}; parent {fragment.ParentRatio:P1}");
}

Fragment handles remain valid only while the pooled piece is active. Reassembly clears the previous ancestry tree, so discard old references. See events and restoration for that lifecycle.

Adapted from the supplied guide · PDF pages 21, 25.View source guide ↗
Keep creating.ERAGAN STUDIO.

Search a topic, setting or method across all package guides.