What's New in Director 8.5 > Working with Lights and Cameras > Working with lights and cameras overview > Light commands |  |

Light commands

Use these commands to work with lights:

Command | Description | Returns
--- | --- | ---
`addChild(``aNode``,` `preserveWorld``)` | Adds the node `aNode` to this light's list of children. An equivalent operation is to set `aNode``.``parent = this light`. The `preserveWorld` argument is optional. It can have two values: `#preserveWorld` or `#preserveParent`. If the value is `#preserveWorld`, the world transform of the child being added remains intact. If `#preserveParent`, the child's transform is interpreted as remaining parent-relative. | Nothing
`child[``index``]` | Returns the child at the specified position in the index. | Lingo light object
`child(``name``)` | Returns a reference to the named child. | Lingo light object
`clone(``name``)` | Clones a light named `name`, adds it to light's parent's child list, and adds it to the world. All children of the light are automatically cloned.This can be avoided by removing the children, performing the cloning operation, and then adding the children back.

If the name is omitted or is `""`, the clone isn't added to the light palette, has no parent, and has no children. This option lets you quickly create temporary light instances.

Lingo light object

`cloneDeep(``name``)` | Clones both the light and all resources used by the light's children. | Lingo light object
`addto`World`()` | Adds light to currently active 3D world, setting its parent as `"world"`.Equivalent to: `light.parent = member` `("scene").light("world")`. All newly created lights are added to the world by default, without it being necessary to use this command. | Nothing
`removeFrom` `World()` | For lights whose parent hierarchy terminates in the world, this sets their parent to `void` and removes them from the world. Otherwise it does nothing. | Nothing
`isInWorld()` | For lights whose parent hierarchy terminates in the world, the value is `TRUE (1)`. | `TRUE (1)` or `FALSE (0)`
`registerScript(``eventName``,` `handlerName``,` `scriptInstance``)` | Registers a handler named `handlerName` that is called in the instance `scriptInstance` when the event `eventName` occurs. If `scriptInstance` is 0, a movie script handler called `eventName` is called. The user defines what `eventName` is. | `TRUE (1)` or `FALSE (0)`, with `TRUE (1)` indicating that the event happened and `FALSE (0)` that it did not
`translate(``xIncrement``,``yIncrement``,``zIncrement``,``relativeTo``)` | Moves the light forward by `xIncrement` along the X axis, `yIncrement` along the Y axis, and `zIncrement` along the Z axis. The `relativeTo` parameter is optional. It determines how arguments are interpreted. The possible values are as follows: `#self`: the default. Increments are applied relative to the light's local coordinate system.

`#parent`: increments are relative to the light's parent's coordinate system.

`#world`: increments are relative to the world's coordinate system. Equivalent to `#parent` if the parent is the world.

`node` (model, light, camera, or group): increments are relative to the argument's coordinate system.

Nothing

`translate(``directionVector``,` `relativeTo``)` | Moves the light `directionVector.length()` in the direction of the vector `directionVector`. The `relativeTo` argument is optional and defaults to `#self`. | Nothing
`translate(x,y,z,relativeTo)` | Moves the light distance x along the X axis, distance y along the Y axis, and distance z along the Z axis. The `relativeTo` argument is optional and defaults to `#self`. This command can also be written astranslate `(vector(``x``,``y``,``z``)` `relativeTo``)` | Nothing
`rotate(x,y,z, relativeTo)` | Rotates the light by x degrees around the X axis, y degrees around the Y axis, and z degrees around the Z axis. The `relativeTo` argument is optional and defaults to `#self`. If included, it defines the coordinate space of the axes. This command can also be written asrotate `(vector(``x``,``y``,``z``)` `relativeTo``)` | Nothing
`rotate (position, axis, angle, relativeTo)` | Rotates the light around the axis vector in the specified position the specified number of degrees. The `relativeTo` argument is optional and defaults to `#self`. | Nothing
`pointAt(worldPosition, worldUp)` | Rotates the light until it points at the world-relative position `worldPosition`. The optional `worldUp` argument indicates the position of the light's Up axis. Both the object-relative axes are defined by the `pointAtOrientation` property. Default values are an object-relative forward direction of vector `(0,0,-1)` and an object-relative up direction of vector `(0,1,0)`. | Nothing
`getWorldTransform()` | Calculates and returns a transform that converts object-relative positions for this light into world-relative positions. | A transform object