Skip to content

Components and systems

stom edited this page Apr 3, 2024 · 4 revisions

Components

MovesWithWorld can be found in src/world/worldMoveComponent.ts. Add this component to any entity you wish to be moved by the Infinity Engine.

engine.defineComponent('moves-with-world-id', {
	// id of entity
	id: Schemas.String, 

	// position in world, 0,0,0 as origin relative to Infinity Engine scene origin, not scene 0,0,0
    position: Schemas.Vector3
})

Systems

System Desc
src/world/movesWithWorldSystem System that moves the world around the player. The player is held in place via the Avatar Trap.
src/world/worldSpacePartitionSystem System determines nearby entities to be loaded and remove far away entities.

Things to keep in mind

  • The more items the MovesWithWorldSystem has to move, the worse performance will be.

  • Keep the number of tracked MovesWithWorld components to a minimum. Parent objects as a much as you can, and assign just the parent to MovesWithWorld.

  • If you assign a Transform.scale to a parent entity using MovesWithWorld it will affect the positions of the children.

  • Will not work with any library that manipulates the Transfrom.position component, unless those libraries account for accepting an alternative component, MovesWithWorld.position. For example: SDK7 Utils, NPC Toolkit, etc.

    • I do have ideas as to how these libraries could support alternate components.
  • MovesWithWorld not work with Tween, as Tween manipulates the Transfrom.position component, but the Infinity Engine uses Transform to perform its work too.

Clone this wiki locally