Razorbill
Components

Core Components

Transform

Every entity that exists in 3D space has a Transform component. It defines position, rotation, and scale.

PropertyTypeDefaultDescription
positionVec3{x: 0, y: 0, z: 0}World-space position
rotationQuaternion{w: 1, x: 0, y: 0, z: 0}World-space rotation as quaternion (w, x, y, z)
scaleVec3{x: 1, y: 1, z: 1}Scale on each axis

Setting Transform via Operations

{
  "op": "SetProperty",
  "params": {
    "entity_name": "MyCube",
    "component_type": "Transform",
    "property_path": "/position",
    "value": { "x": 0, "y": 5, "z": -3 }
  }
}

Accessing Transform in Scripts

void OnUpdate(ScriptContext* ctx) {
    float pos[3];
    ctx->get_position(ctx->self, pos);

    // Move forward
    pos[2] += ctx->get_delta_time() * 5.0f;
    ctx->set_position(ctx->self, pos);
}

CameraComponent

Defines how the scene is viewed. Supports perspective and orthographic projection.

PropertyTypeDefaultDescription
projectionEnumperspectiveProjection type: perspective or orthographic
fovFloat60Field of view in degrees (perspective only)
near_planeFloat0.1Near clipping plane distance
far_planeFloat1000Far clipping plane distance
ortho_sizeFloat5Half-height of orthographic view (orthographic only)

Example: Security Camera Setup

[
  {
    "op": "CreateEntity",
    "params": { "name": "SecurityCam" }
  },
  {
    "op": "AddComponent",
    "params": {
      "entity_name": "SecurityCam",
      "component_type": "Transform",
      "data": {
        "position": { "x": 10, "y": 8, "z": -5 },
        "rotation": { "w": 0.924, "x": -0.383, "y": 0, "z": 0 }
      }
    }
  },
  {
    "op": "AddComponent",
    "params": {
      "entity_name": "SecurityCam",
      "component_type": "CameraComponent",
      "data": {
        "projection": "perspective",
        "fov": 45,
        "near_plane": 0.5,
        "far_plane": 200
      }
    }
  }
]

Scripting: Switch Active Camera

void OnUpdate(ScriptContext* ctx) {
    // Press C to switch to this camera
    if (ctx->is_key_pressed(ctx, 67)) { // 67 = 'C'
        ctx->set_active_camera(ctx, ctx->self);
    }
}

On this page