• 3D2D buttons hitbox moving based on players angle..?
    2 replies, posted
Making an addon, and one of my entities has 3D2D buttons for it's interaction. If i'm directly infront of the button, it works fine, while if i move angle, the hitbox moves away from the top of the button. I don't really know how to explain it so I drew up a quick "diagram". In the first one, the button is in the correct place, with the trace picking it up fine and it being rendered fine. https://files.facepunch.com/forum/upload/112953/f6cfd316-719f-4f84-b252-dafddae63e09/image.png In the second one, ply moves across, and while the visual side is fine, the hitbox for the button (Part in red) moves. Not sure if this is to do with the trace not responding correctly with the players new angle or what. https://files.facepunch.com/forum/upload/112953/b90b09c8-32b6-46cb-b26c-c43c62591622/image.png I know it's not explained very well, so if you need to ask anything else just ask. Thanks. (Btw, when I say "Hitbox", i mean the entity checking the trace pos and if it's in the bounds of the button)
I'm assuming you already coded something, if so you should post it so people can actually fix the issue.
It's just a simple bit of trace code in the 3D2D. I can't show too much for private reasons, but i'l try to show the parts you'll need. function ENT:DrawTranslucent()     local ang = self:GetAngles()     local lpos = Vector(10.75, -11.8, 38.7)     local pos = self:LocalToWorld(lpos)     ang:RotateAroundAxis(self:GetAngles():Forward(), 62)     ang:RotateAroundAxis(self:GetAngles():Up(), 90)     local w,h = 345,200     cam.Start3D2D(pos, ang, 0.1)     -- Draw the 3D2D stuff here.     -- Move onto the Trace.     local Trace = self:WorldToLocal(LocalPlayer():GetEyeTrace().HitPos)     if(Trace.y >= -9.1 && Trace.y <= -3.82 && Trace.x >= 23.47 && Trace.x <= 24.46) then         draw.RoundedBox(5, w * 0.05, h * 0.6, w * 0.2, h * 0.3, Color(50, 50, 50, 255))     else         draw.RoundedBox(5, w * 0.05, h * 0.6, w * 0.2, h * 0.3, Color(35, 35, 35, 255))     end     cam.End3D2D() end
Sorry, you need to Log In to post a reply to this thread.