Factor in hands for fade
This commit is contained in:
parent
a32f96268a
commit
6d8ee9ce24
19
main.lua
19
main.lua
|
@ -308,8 +308,23 @@ function modeConfigure(pass)
|
||||||
end
|
end
|
||||||
|
|
||||||
function modeDraw(pass)
|
function modeDraw(pass)
|
||||||
local x, y, z = lovr.headset.getPosition("head")
|
local hx, hy, hz = lovr.headset.getPosition("head")
|
||||||
local closestDist = getClosestDistanceToPerimeter(x, y, z, settings.points)
|
|
||||||
|
-- Calculate the distance from the head to the perimeter
|
||||||
|
local perimeterDistHead = getClosestDistanceToPerimeter(hx, hy, hz, settings.points)
|
||||||
|
|
||||||
|
-- Check distance from each hand to the perimeter
|
||||||
|
local handDistances = {perimeterDistHead}
|
||||||
|
for _, hand in ipairs(hands) do
|
||||||
|
if isTracked(hand) then
|
||||||
|
local handX, handY, handZ = lovr.headset.getPosition(hand)
|
||||||
|
local dist = getClosestDistanceToPerimeter(handX, handY, handZ, settings.points)
|
||||||
|
table.insert(handDistances, dist)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Take the minimum of the distances for the fade logic
|
||||||
|
local closestDist = math.min(unpack(handDistances))
|
||||||
|
|
||||||
-- Update the fade logic based on the closest distance
|
-- Update the fade logic based on the closest distance
|
||||||
closestDist = (closestDist - settings.fade_stop) / (settings.fade_start - settings.fade_stop)
|
closestDist = (closestDist - settings.fade_stop) / (settings.fade_start - settings.fade_stop)
|
||||||
|
|
Loading…
Reference in a new issue