originalnicodr / RELit

Mod to spawn lights in RE Engine games
https://framedsc.com/GeneralGuides/relit.htm
25 stars 4 forks source link

Add imgui controls to move the lights position (and maybe orientation) #1

Closed originalnicodr closed 2 years ago

originalnicodr commented 2 years ago

Thought of doing something like the following:

local lightTransform = light:call("get_Transform")
local light_pos = lightTransform:get_position()

changedX, newXValue = imgui.drag_float("X", light_pos:call("get_Item",1), 0.1, -10000, 10000)
changedY, newYValue = imgui.drag_float("Y", light_pos:call("get_Item",2), 0.1, -10000, 10000)
changedZ, newZValue = imgui.drag_float("Z", light_pos:call("get_Item",3), 0.1, -10000, 10000)

if changedX or changedY or changedZ then
    if not changedX then newXValue = light_pos:call("get_Item",1) end
    if not changedY then newYValue = light_pos:call("get_Item",2) end
    if not changedZ then newZValue = light_pos:call("get_Item",3) end
    lightTransform:set_position(Vector3f.new(newXValue, newYValue, newZValue))
end

Unfortunately, I am having trouble getting the object coordinates. If you happen to know how we could make this work please let me know.

FransBouma commented 2 years ago

light position move will only work if you write them into the WorldMatrix data as that's the real view. So either stop writing that and call set_position (which should work tho) or write the coords in the WorldMatrix obtained from the camera.