# Command: CreateLight

CreateLight ( [type][,parent] )

Parameters:

type (optional) - type of light 1: directional 2: point 3: spot parent (optional) - parent entity of light

Description:

Creates a light.

Lights work by affecting the colour of all vertices within the light's range. You need at to create at least one light if you wish to use 3D graphics otherwise everything will appear flat.
The optional type parameter allows you to specify the type of light you wish to create. A value of 1 creates a directional light. This works similar to a sun shining on a house. All walls facing a certain direction are lit the same. How much they are lit by depends on the angle of the light reaching them.
A value of 2 creates a point light. This works a little bit like a light bulb in a house, starting from a central point and gradually fading outwards.
A value of 3 creates a spot light. This is a cone of light. This works similar to shining a torch in a house. It starts with an inner angle of light, and then extends towards an outer angle of light.

The optional parent parameter allow you to specify a parent entity for the light so that when the parent is moved the child light will move with it. However, this relationship is one way; applying movement commands to the child will not affect the parent.

Specifying a parent entity will still result in the light being created at position 0,0,0 rather than at the parent entity's position.

Example:

None.

Index