Skip to main content

LightBuilder

A builder for the Light item.

Extends GenericItemBuilder

Example

import OBR, { buildLight } from "@owlbear-rodeo/sdk";

const gridDpi = await OBR.scene.grid.getDpi();
// 12 grid squares or 60ft in a 5ft grid system
const visionRadius = gridDpi * 12;

const myCharacter = await OBR.scene.items.get(id);
const item = buildLight()
.position(myCharacter.position)
.attenuationRadius(visionRadius)
.attachedTo(myCharacter.id)
.build();
OBR.scene.local.addItems([item]);

Reference

Methods

sourceRadius

sourceRadius(sourceRadius);

Set the lights sourceRadius.

Parameters

NAMETYPEDESCRIPTION
sourceRadiusnumberThe lights sourceRadius value

Returns the current builder.


attenuationRadius

attenuationRadius(attenuationRadius);

Set the lights attenuationRadius.

Parameters

NAMETYPEDESCRIPTION
attenuationRadiusnumberThe lights attenuationRadius value

Returns the current builder.


falloff

falloff(falloff);

Set the lights falloff.

Parameters

NAMETYPEDESCRIPTION
falloffnumberThe lights falloff value

Returns the current builder.


innerAngle

innerAngle(innerAngle);

Set the lights innerAngle.

Parameters

NAMETYPEDESCRIPTION
innerAnglenumberThe lights innerAngle value

Returns the current builder.


outerAngle

outerAngle(outerAngle);

Set the lights outerAngle.

Parameters

NAMETYPEDESCRIPTION
outerAnglenumberThe lights outerAngle value

Returns the current builder.


build

build();

Returns the final Light item.