This document describes the semantics of changing parenting of entities and what happens when an entity in the middle of a branch of the tree is removed. The problem is complex because in an ECS approach, entities are stored in a flat structure, and trees are a synthetic construct for positioning purposes only. The decision is that when an entity in the middle of a branch is removed, all its children will be re-parented to the root entity.
Transform
component doesn't exist in an entity, it is assumed that the
entity has a scale={1,1,1}
.
Transform
component has the same
rendering semantics than an entity with a Transform.Identity
.
Transform.Identity
by default.
Transform.Identity
component.
Transform
component of the entity B is that the entity
have a Transform.Identity
component.
Transform.Identity
and the change of the matrix
calculation of all its children should take it into account.
After creating and emparenting entities with explicit transform in the form:
ROOT_ENTITY
└── A
└── B
└── C
└── D
└── E
└── F
Transform
component from entity D, the engine should assume
entity D has a Transform.Identity
component.
Transform.Identity
component has parent=ROOT_ENTITY
, the
rendering tree now looks like:
ROOT_ENTITY
├── A
│ └── B
│ └── C
└── D
└── E
└── F
Appendix
Transform.Identity = {
scale = {1,1,1}
position = {0,0,0}
rotation = {0,0,0,1}
parent = ROOT_ENTITY
}
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in RFC 2119 and RFC 8174.