• Cam 3d2d angles being wonky?
    3 replies, posted
I was dumb and thought I fixed it so I edited the post saying it was solved, but here I am putting it back. [code] function ENT:Draw() self:DrawModel() local ang = self:GetAngles() local fwd = ang:Forward() local camangle = Angle(ang.p, ang.y, ang.r) local pos = self:GetPos() + (ang:Up() * 11.88) + (ang:Right() * -2) cam.Start3D2D(pos, camangle, .3) draw.DrawText("Seller Side", "DebugFixed", 0, 0, Color(255, 255, 255, 255), TEXT_ALIGN_CENTER) cam.End3D2D() local pos = self:GetPos() + (ang:Up() * -11.88) + (ang:Right() * -2) local camangle2 = -ang + Angle(0, 0, -180) cam.Start3D2D(pos, camangle2, .3) draw.DrawText("Buyer Side", "DebugFixed", 0, 0, Color(255, 255, 255, 255), TEXT_ALIGN_CENTER) cam.End3D2D() end [/code] [IMG]http://images.akamai.steamusercontent.com/ugc/447331389954095730/CCB97BD6E5AC6BCDBE8FB4C3AABA174A8CB8E1DC/[/IMG] [IMG]http://images.akamai.steamusercontent.com/ugc/447331389954094886/BFD28EFFFA27E6B020A19CE9582E6B0489ED9351/[/IMG]
Change [lua] local camangle2 = -ang + Angle(0, 0, -180) cam.Start3D2D(pos, camangle2, .3)[/lua] to [lua] camangle:RotateAroundAxis(camangle:Up(),180) cam.Start3D2D(pos, camangle, .3)[/lua] [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/Angle/RotateAroundAxis]Angle:RotateAroundAxis[/url]
[QUOTE=wh1t3rabbit;48287156]Change [lua] local camangle2 = -ang + Angle(0, 0, -180) cam.Start3D2D(pos, camangle2, .3)[/lua] to [lua] camangle:RotateAroundAxis(camangle:Up(),180) cam.Start3D2D(pos, camangle, .3)[/lua] [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/Angle/RotateAroundAxis]Angle:RotateAroundAxis[/url][/QUOTE] Now it's upside down and backwards.
Then try rotating again on different axis. Just play with it until you get it right. The point is you can't just 'add' an angle to it the way you were because that doesn't take into account how it is already rotated.
Sorry, you need to Log In to post a reply to this thread.