Skip to content

Light

Light types: Point=0, Sun=1, Spot=2, Hemi=3, Area=4. Attach to a Node via setNode(node) so the light’s position/direction follows the node.

Returns: Light — A new light. Attach to a node and set a tag so Scene.findLightByTag can find it.

Method / propertyReturns / ParametersDescription
getTag()StringTag for findLightByTag
setTag(tag)tag (String) — Set the tag
nodeNode or nullNode this light is attached to
setNode(node)node (Node) — Attach light to this node
PropertyTypeDescription
type / type=(t)Num (0–4)Light type: Point=0, Sun=1, Spot=2, Hemi=3, Area=4
r / g / bNum (0–1)Red, green, blue (linear RGB)
setColor(r, g, b)r, g, b (Num) — Set color (0–1)
energy / energy=(e)NumIntensity/energy of the light
var light = _scene.addLight()
light.setTag("main_light")
var lightNode = _scene.addNode("LightNode")
lightNode.setPosition(4, 4, 4)
light.setNode(lightNode)
light.type = 0
light.setColor(1, 1, 1)
light.energy = 1000
PropertyTypeDescription
radius / radius=(r)NumRadius for soft shadows
spotAngle / spotAngle=(a)NumSpot light cone angle (radians)
spotBlend / spotBlend=(b)NumSpot edge softness (0–1)
areaWidth / areaHeightNumArea light width/height
setAreaSize(w, h)w, h (Num) — Set area size