Skip to content

TransformSyncSystem

Applies TransformComponent position, rotation, and scale values to the linked THREE.js Object3D every frame.

Overview

TransformSyncSystem runs every frame (just before RenderSystem) and is responsible for:

  • Querying all entities that have both a TransformComponent and an Object3DRef.
  • Calling object.position.set(...), object.rotation.set(...), and object.scale.set(...) from the component values.
  • Calling object.updateMatrixWorld(true) after applying the transform to propagate changes to child objects.

Queried components

ComponentAccess
TransformComponentRead (position, rotation, scale)
Object3DRefRead (the live THREE.js object)

Behavior notes

  • Every frame — transforms are applied unconditionally every frame. Scripts and inspector edits can mutate TransformComponent at any point and the result will be visible on the next render.
  • World matrix propagationupdateMatrixWorld(true) is called with force = true so that child objects in the hierarchy receive updated world matrices even if the parent did not mark itself dirty.
  • OrderingTransformSyncSystem runs after all custom systems and before RenderSystem. This guarantees that script-driven position changes (from onUpdate) are reflected in the same frame they are written.

API reference