3d2d ui weird angles

I’m using the PostDrawTranslucentRenderables hook and create a table outside of the hook called GlobalTable just for testing purposes outside of the hook the values are printed normally but when inside the hook the spaze out from these values
-0.000 -90.000 0.000
-0.000 -180.000 90.000
90.000 0.000 0.000
-0.000 -90.000 0.000
-0.000 -180.000 90.000

but if i were to set the angle using Angle(90,0,0) it works fine even though thats what GlobalTable.angle is.

local tdui = include( "tdui.lua" )
GlobalTable = GlobalTable or {}
local p
GlobalTable.angle = GlobalTable.angle or Angle(90,0,0)
hook.Add("PostDrawTranslucentRenderables", "Paint3D2DUI", function(bDrawingSkybox, bDrawingDepth)

    if bDrawingDepth then return end

    p = p or tdui.Create()

    p:Rect(-500, 0, 1000, 1000, Color(255,255,20,50), Color(0, 0, 255))
    yval = 50

    p:Text("Text!", "!Roboto@100", 0, 20)

    if p:Button("Test", "DermaLarge", -200, 160, 400, 100) then
        RunConsoleCommand("say", "test")


    p:Render(GlobalTable.origin+Vector(0,0,yval), GlobalTable.angle, 0.2)

concommand.Add("test", function()
  local tr = LocalPlayer():GetEyeTrace()
  GlobalTable.origin = tr.HitPos + tr.HitNormal * 4
  GlobalTable.angle = tr.HitNormal:Angle()

I don’t understand what you’re saying. What I do know, though, is that PostDrawTranslucentRenderables is actually called multiple times per frame, with some of those (specifically the skybox one) having weird angles like you described.

See http://wiki.garrysmod.com/page/Render_Order

GlobalTable.angle is a set value but when i do print(GlobalTable.angle) it does the spazzing but if i do Angle() instead its fine i dont know why the value changes in the hook

[editline]19th September 2016[/editline]

you’re probably changing it somewhere else. perhaps in another file?

Nope as i said when i print GlobalTable.angle outside of the hook it is how it should be but when inside the hook it spazes out

angles don’t change by themselves. It must mean that something is changing it and then changing it back. Why are you using a global anyway? If you have to use a global table, why not give it a more unique name? it’s possible that you have a badly-coded mod that uses a global table with the same name.

Its badly coded because it was made in 5 minutes so i know for a fact its not GlobalTable as that was a test name and ive done many other names i know how to do stuff like this so thats why its confusing me, like i said outside the hook it prints the angle fine inside the hook it doesnt with any name even using GlobalTable.UIAngle does the same its not the table because GlobalTable.origin works perfectly fine in the code and puts it where its supposed to go

[editline]19th September 2016[/editline]

It’d do the same if i used a global value or put it in a function like function(ang) i tried this and tried using ang and as said it just does the same stuff constantly

[editline]19th September 2016[/editline]

Also on a clean gmod only with gcompute and im not even using it right now so nothing is conflicting


p:Render(GlobalTable.origin+Vector(0,0,yval), Angle(GlobalTable.angle.p, GlobalTable.angle.y,GlobalTable.angle.r), 0.2)

Basically give the function a copy of your global angle.

The function may be modifying the angle.


Update your tdui library to the newest version, it should be fixed.

Its fixed thanks guys!