'Hey Brusalk! Syronius @ Kilrogg in <Modest> here. You can play with
frame depth if you'd like. I believe that's the only parameter available in the API to adjust the 3D position. As far as determining the mouse depth, I don't believe that's possible.
Since all frame objects eventually parent to the main UIParent frame, you can try using the depth parameter on the UIParent frame as follows:
Code:
UIParent:SetDepth(value)
Alternatively you can have a mouse tracking system that will change the depth of the UIParent depending on the position of the mouse (probably the best way to do this).
Here's a rough untested script:
Code:
local f = CreateFrame("Frame",nil,UIParent)
local scale = UIParent:GetEffectiveScale()
local centerX = ((GetScreenWidth()*scale)/2)
local centerY = ((GetScreenHeight()*scale)/2)
local delayInt = 0.2 -- Delay integer limits update speed
f:SetScript("OnUpdate",function(self,elapsed)
delayInt = delayInt - elapsed
if delayInt < 0 then -- After delay has completed run code
local x,y = GetCursorPosition()
local x,y = (x/scale),(y/scale) -- Adjusts for UI Scaling
if (x < (centerX+200) and x > (centerX-200)) and (y < (centerY+200) and y > (centerY-200)) -- Center of the screen
UIParent:SetDepth(10)
elseif (x > (centerX+200) or x < (centerX-200)) or (y > (centerY+200) or y < (centerY-200)) then -- Outsides
UIParent:SetDepth(1)
end
delayInt = 0.2 -- Reset integer after running code
end
end)