Ara
Download

Search or run a command

Jump to a section or open an Ara link.

Component · twoD

Light2d

Point light for an explicitly lit sprite; Z provides normal-map elevation.

Fields

position

vec3
Position in world metres.
default [0,0,0]

color

vec3
Linear RGB intensity.
default [1,1,1]

radius

f32
Finite influence radius in metres.
default 5≥ 0.001

shadows

bool
Test tile/sprite occluder segments between light and fragment.
default false

Usage

Every edit is an undoable command: from the CLI as below, or the same JSON from an agent over MCP. See component.add and property.set.

Add it

ara do component.add -p entity=name:Crate -p component=Light2d --why "Add Light2d"

Set a field

ara do property.set -p entity=name:Crate -p path=Light2d.position -p value=[0,0,0] --why "Tune Light2d"

In a scene document

{
  "Light2d": {
    "position": [
      0,
      0,
      0
    ]
  }
}

From C#

/// <summary>Extend a 2D lantern radius.</summary>
public static void UseLight2d(Entity entity, in Tick tick)
{
    ref var component = ref World.Get<Light2d>(entity);
    component.Radius = 8f;
}

From C#

Scripts read and write it with Get<Light2d>(); see the Light2d struct.

Used by