setLightDirection
Client
Changes where a spot or rect light points.
bool setLightDirection(light light, float x, y, z)
Parameters
| Name | Type | Description |
|---|---|---|
| light | light | The light. |
| x, y, z | float | Where the light points. Three numbers or a vec3, finite and non-zero; it is normalised. |
Returns
true if it changed. With a wrong argument it logs a warning and returns false.
While the light is attached to another element, the direction is relative to it. A rect light's tangent is made across the new direction again.
Example
local light = createSpotLight(2495.1, -1687.4, 20, 0, 0, -1, 25)
addEventHandler("onClientRender", root, function()
local angle = getTickCount() / 1000
setLightDirection(light, math.cos(angle), math.sin(angle), -1)
end)NoteSpot and rect lights only. On a point light it logs a warning and returns
false.