Originally Posted by Brusalk
When running in Steroscopic 3D mode with the mouse in software mode the mouse will auto-adjust it's depth to the depth of what it's over in the game world.
This is great and all, but the problem I'm finding is that the UI as a whole just sits right on the screen which makes looking at UI elements quite hard with double-vision resulting from looking "past" the UI.
I'm trying to find a way to adjust the UI to where the mouse is so I'm curious if there's either a way people know of to adjust the whole UI depth, and/or get the depth of the mouse.
Thanks for any help you can give me!
|
'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:
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:
Lua 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)