createRectLight
Client
Creates a light that comes from a rectangle, like a panel or a lit window. The light exists on this client only.
light|false createRectLight(float x, y, z, float normalX, normalY, normalZ [, float radius = 8, color color = tocolor(255, 255, 255), float width = 1, float height = 1])
Parameters
| Name | Type | Description |
|---|---|---|
| x, y, z | float | The light's position in the world, three numbers or a vec3. |
| normalX, normalY, normalZ | float | Where the rectangle's face points. Three numbers or a vec3, finite and non-zero; it is normalised. The light shines only in front. |
| radius | float | Range in metres, above 0 and up to 1000.default 8 |
| color | color | Three numbers r, g, b (integers from 0 to 255) or a tocolor value. Alpha is ignored.default tocolor(255, 255, 255) |
| width | float | Width of the rectangle in metres, from 0.01 to 100.default 1 |
| height | float | Height of the rectangle in metres, from 0.01 to 100.default 1 |
Returns
The created light element, or false if it could not be created.
The width runs along a tangent made from the normal and the world's up axis; change it with setLightTangent. The barn doors start at 88 degrees and 0.2 metres, so they block nothing. A light outside the focused dimension or area is not drawn.
Example
local light = createRectLight(1481.0, -1771.0, 22.0, 0, -1, 0, 12, 200, 220, 255, 4, 0.5)
setLightIntensity(light, 3)Coming from MTAMTA has no dynamic lights. To light a single frame without creating an element, use
dxDrawRectLight.