Skip to content

Components

Components are data attached to entities. In ESEngine, you define components in code and attach them to entities in the scene editor.

Builtin Components

Builtin components are always available in the editor. They are backed by the C++ backend.

LocalTransform

Position, rotation, and scale of an entity.

PropertyTypeDescription
positionVec3World position { x, y, z }
rotationQuatQuaternion { w, x, y, z }
scaleVec3Scale factor { x, y, z }

Sprite

2D sprite rendering. Requires LocalTransform to be visible. See Sprite guide for full details.

Camera

View settings. At least one active camera is required to see anything. The editor’s default scene includes one.

PropertyTypeDescription
projectionTypenumber0 = Perspective, 1 = Orthographic
fovnumberField of view in degrees (perspective only)
orthoSizenumberHalf-height in world units (orthographic only)
nearPlanenumberNear clipping plane
farPlanenumberFar clipping plane
isActivebooleanWhether this camera is used for rendering
aspectRationumberCamera aspect ratio
prioritynumberRender order — lower priority renders first, higher renders on top
viewportXnumberViewport left edge (0–1). Default: 0
viewportYnumberViewport bottom edge (0–1). Default: 0
viewportWnumberViewport width (0–1). Default: 1
viewportHnumberViewport height (0–1). Default: 1
clearFlagsnumberBuffer clear mode: 0=None, 1=Color, 2=Depth, 3=Both
showFrustumbooleanDraw the camera frustum wireframe in the editor

Canvas

Display settings for the rendering surface.

PropertyTypeDescription
designResolutionVec2Design resolution { x, y }
pixelsPerUnitnumberPixels per world unit
scaleModenumberHow the canvas scales
matchWidthOrHeightnumberBalance between width/height matching
backgroundColorColorClear color RGBA

Velocity

Movement velocity.

PropertyTypeDescription
linearVec3Linear velocity
angularVec3Angular velocity

Parent / Children

Entity hierarchy for scene graphs.

ComponentPropertyTypeDescription
ParententityEntityParent entity ID
ChildrenentitiesEntity[]List of child entity IDs

SpineAnimation

Spine skeletal animation playback. Requires LocalTransform. See Spine Animation guide for full details.

BitmapText

GPU-rendered text using pre-baked bitmap font atlases (BMFont format). Requires LocalTransform. See Bitmap Text guide for full details.

PropertyTypeDescription
textstringText content
colorColorTint color RGBA
fontSizenumberScale factor relative to the font’s native size
alignnumberHorizontal alignment: 0=Left, 1=Center, 2=Right
spacingnumberExtra spacing between characters
layernumberRender layer
fontnumberFont handle from assets.loadBitmapFont()

Text

UI text rendering. Works with UIRect and Sprite to display text. See UI & Text guide for full details.

PropertyTypeDescription
contentstringText content
fontFamilystringFont family
fontSizenumberFont size in pixels
colorColorText color RGBA
alignTextAlignHorizontal alignment
verticalAlignTextVerticalAlignVertical alignment

UIRect

UI layout rectangle. Defines size, anchor, and pivot for UI elements.

PropertyTypeDescription
sizeVec2Width and height
anchorVec2Anchor point (0–1)
pivotVec2Pivot point for rotation

UIMask

Clips child entities to the parent’s UIRect bounds. Requires UIRect and LocalTransform on the same entity. See UI & Text guide for details.

PropertyTypeDefaultDescription
enabledbooleantrueWhether clipping is active

Name

A string identifier for the entity. Useful for finding entities by name at runtime.

PropertyTypeDefaultDescription
valuestring''Entity name

Physics

Physics components require the PhysicsPlugin. See Physics guide for setup and usage.

RigidBody

Physics body attached to an entity. Requires LocalTransform.

PropertyTypeDefaultDescription
bodyTypenumber2 (Dynamic)0=Static, 1=Kinematic, 2=Dynamic
gravityScalenumber1.0Gravity multiplier
linearDampingnumber0.0Linear velocity damping
angularDampingnumber0.0Angular velocity damping
fixedRotationbooleanfalseLock rotation
bulletbooleanfalseContinuous collision detection for fast objects
enabledbooleantrueEnable physics body

BoxCollider

PropertyTypeDefaultDescription
halfExtentsVec2{x: 0.5, y: 0.5}Half size in meters
offsetVec2{x: 0, y: 0}Local offset
densitynumber1.0Mass density
frictionnumber0.3Surface friction
restitutionnumber0.0Bounciness
isSensorbooleanfalseTrigger-only (no physical response)

CircleCollider

PropertyTypeDefaultDescription
radiusnumber0.5Circle radius in meters
offsetVec2{x: 0, y: 0}Local offset
densitynumber1.0Mass density
frictionnumber0.3Surface friction
restitutionnumber0.0Bounciness
isSensorbooleanfalseTrigger-only (no physical response)

CapsuleCollider

PropertyTypeDefaultDescription
radiusnumber0.25Capsule radius
halfHeightnumber0.5Half height of the capsule body
offsetVec2{x: 0, y: 0}Local offset
densitynumber1.0Mass density
frictionnumber0.3Surface friction
restitutionnumber0.0Bounciness
isSensorbooleanfalseTrigger-only (no physical response)

Custom Components

defineComponent

Define a data component in code. After saving, it appears in the editor’s “Add Component” menu.

import { defineComponent } from 'esengine';
export const Health = defineComponent('Health', {
current: 100,
max: 100
});

Then in the editor: select an entity → Add Component → Health → set values in the inspector.

Systems query entities with this component:

import { defineSystem, addSystem, Query } from 'esengine';
import { Health } from './components/Health';
addSystem(defineSystem(
[Query(Health)],
(query) => {
for (const [entity, health] of query) {
if (health.current <= 0) {
// handle death
}
}
}
));

defineTag

A tag component has no data — it’s used purely for filtering entities.

import { defineTag } from 'esengine';
export const Player = defineTag('Player');
export const Enemy = defineTag('Enemy');

Attach Player to an entity in the editor, then query it:

addSystem(defineSystem(
[Query(LocalTransform, Player)],
(query) => {
for (const [entity, transform] of query) {
// only processes entities with the Player tag
}
}
));

Runtime Entity Spawning

For entities created at runtime (bullets, particles, effects), use Commands:

import { addStartupSystem, defineSystem, Commands, Sprite, LocalTransform } from 'esengine';
addStartupSystem(defineSystem(
[Commands()],
(cmds) => {
const entity = cmds.spawn()
.insert(Sprite, { size: { x: 10, y: 10 } })
.insert(LocalTransform, { position: { x: 0, y: 0, z: 0 } })
.id();
}
));

Removing Components at Runtime

cmds.entity(entity).remove(Velocity);

Next Steps

  • Systems — logic that operates on components
  • Queries — finding entities by component