convertPositionTo
Converts a position relative to the current entity to a targetEntity.
Attention: "relative to" an Entity is different from "in the local coordinate system/space of" the Entity. You may use the converted result to place an entity when you need a position in that entity's local coordinate space. In this case, the proper targetEntity should be the parent of the entity to place. For example, if entityA and entityB are in different coordinate spaces, and positionA is relative to entityA, pass entityB's parent as targetEntity when placing entityB at positionA.
entityB.components.get<TransformComponent>()?.position = entityA.convertPositionTo(positionA,
entityB.getParent())Return
The converted position relative to targetEntity, or relative to the current entity's SpatialContainer when targetEntity is null.
Parameters
The position relative to the current entity.
The target entity to which the position will be converted. If null, the position is converted relative to the SpatialContainer where the current entity is placed.