Skip to content
This repository has been archived by the owner on May 27, 2023. It is now read-only.

Commit

Permalink
Set initial direction using rotation
Browse files Browse the repository at this point in the history
  • Loading branch information
patrikjuvonen committed Aug 17, 2021
1 parent 8bebe2d commit 8b515ff
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion c_editor_addon.lua
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,9 @@ local function createLight(element)

local lightType = exports.edf:edfGetElementProperty(element, "type")
local x, y, z = exports.edf:edfGetElementPosition(element)
local tx, ty, tz = unpack(exports.edf:edfGetElementProperty(element, "target"))
local _, _, rz = exports.edf:edfGetElementRotation(element)
local _tx, _ty, tz = unpack(exports.edf:edfGetElementProperty(element, "target"))
local tx, ty = x + (_tx - x) * math.cos(math.rad(rz)) - (_ty - y) * math.sin(math.rad(rz)), y + (_tx - x) * math.sin(math.rad(rz)) + (_ty - y) * math.cos(math.rad(rz))
local r, g, b, a = hex2rgba(exports.edf:edfGetElementProperty(element, "color"))
local attenuation = exports.edf:edfGetElementProperty(element, "attenuation") or 5
local dimension = exports.edf:edfGetElementDimension(element) or 0
Expand Down

0 comments on commit 8b515ff

Please sign in to comment.