t1k:unity:base:pivot-hierarchy
| Field | Value |
|---|---|
| Module | base |
| Version | 2.2.2 |
| Effort | medium |
| Tools | — |
Keywords: hierarchy, pivot, transform, unity
How to invoke
Section titled “How to invoke”/t1k:unity:base:pivot-hierarchyUnity Pivot & Hierarchy Patterns
Section titled “Unity Pivot & Hierarchy Patterns”Guide for the “empty parent + offset child” hierarchy pattern. Applies to pivot fixing, rotation pivots, orbits, attachment sockets, animation isolation, and DOTS ECS baking.
Scope: GameObject hierarchy restructuring for pivot control. Does NOT cover animation rigging, IK solvers, or physics joints.
Core Concept
Section titled “Core Concept”- Create empty parent GO at logical position (feet, rotation center, socket)
- Add child GO with mesh/visual at calculated offset
- Parent controls world position/rotation; child controls visual offset
Root (empty) ← position = feet / rotation center / socket └─ Mesh (child) ← localPosition = (0, offset, 0), has MeshFilter + MeshRendererOffset Calculation Reference
Section titled “Offset Calculation Reference”Unity built-in primitive half-heights at scale 1:
| Primitive | Height | Half-Height | Offset Formula |
|---|---|---|---|
| Capsule | 2m | 1.0 | 1.0 * scale.y |
| Cylinder | 2m | 1.0 | 1.0 * scale.y |
| Cube | 1m | 0.5 | 0.5 * scale.y |
| Sphere | 1m | 0.5 | 0.5 * scale.y |
| Custom mesh | varies | bounds.extents.y | mesh.bounds.extents.y * scale.y |
Scale goes on child, not parent. Offset in parent-local space.
DOTS Critical Gotchas
Section titled “DOTS Critical Gotchas”- PostTransformMatrix conflicts with TransformBaker — adding manually in a custom baker causes entity count drops and broken SubScene loading. Only use via
TransformUsageFlags.NonUniformScale. - “Fix the data, not the code” — restructure the prefab hierarchy rather than compensating in runtime systems.
+= offsetaccumulates per frame — use=(absolute) or fix in prefab.
→ Full use cases (A-F), DOTS baking behavior, ECS parent-child setup, decision framework: references/use-cases-and-ecs.md
Reference Files
Section titled “Reference Files”| File | Contents |
|---|---|
| use-cases-and-ecs.md | Use cases A-F with code, DOTS baking, ECS gotchas, decision framework |