Skip to main content

Function: createUiWorldSpaceFollowEcsSystem()

createUiWorldSpaceFollowEcsSystem(): EcsSystem<[UiWorldSpaceFollowEcsComponent, PositionEcsComponent]>

Defined in: ui/systems/ui-world-space-follow-system.ts:27

Creates a system that overwrites every UiWorldSpaceFollowEcsComponent entity's PositionEcsComponent.world with its target's own world position plus this entity's already-resolved local offset - the world position only, never the target's rotation or scale, unlike an ordinary ParentEcsComponent relationship (see that component's own follow-vs-parent doc comment for why this is a separate mechanism).

Must be registered after createTransformEcsSystem (so target's world position for this tick is already resolved) - unlike the rest of the UI pipeline, createUiCanvas does not register this one for you, since its one dependency runs the opposite direction from every other UI system (which all run before createTransformEcsSystem). Register it yourself, once, right after createTransformEcsSystem, for any world using renderMode: 'worldSpace' canvases that should follow a target.

Returns​

EcsSystem<[UiWorldSpaceFollowEcsComponent, PositionEcsComponent]>

The UI world-space follow ECS system.

Throws​

An error if a UiWorldSpaceFollowEcsComponent.target has no PositionEcsComponent.