From abec33b76a88dace1cda1f5af31ec74d8e4466b7 Mon Sep 17 00:00:00 2001 From: Deyan Dobromirov Date: Fri, 15 Nov 2024 16:59:20 +0200 Subject: [PATCH] Added: Load the node into tool offsets --- .../gmod_tool/stools/trackassembly.lua | 22 +++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/lua/weapons/gmod_tool/stools/trackassembly.lua b/lua/weapons/gmod_tool/stools/trackassembly.lua index e9643e7e..2ad326bd 100644 --- a/lua/weapons/gmod_tool/stools/trackassembly.lua +++ b/lua/weapons/gmod_tool/stools/trackassembly.lua @@ -998,11 +998,25 @@ function TOOL:CurveUpdate(stTrace, bPnt, bMute) asmlib.Notify(user,"Populate nodes first !","ERROR") asmlib.LogInstance("Nodes missing", gtLogs); return nil end - --[[ TODO: - Update P/Y/R offsets and use then to store the curve normal - Update X,Y,X offsets and use them to store the curve origin - ]] local mD, mL = asmlib.GetNearest(tData.Hit, tC.Base) + local nextx, nexty, nextz = self:GetPosOffsets() + if(nextx == 0 and nexty == 0 and nextz == 0) then + local vN, vB = tC.Node[mD], tC.Base[mD] + local vO = Vector(); vO:Set(vN); vO:Sub(vB) + nextx, nexty, nextz = vO:Unpack() + asmlib.SetAsmConvar(oPly,"nextx", nextx) + asmlib.SetAsmConvar(oPly,"nexty", nexty) + asmlib.SetAsmConvar(oPly,"nextz", nextz) + end + local nextpic, nextyaw, nextrol = self:GetAngOffsets() + if(nextpic == 0 and nextyaw == 0 and nextrol == 0) then + local aO = C.Norm[mD]:Angle() + aO:RotateAroundAxis(aO:Right(), 90) + nextpic, nextyaw, nextrol = aO:Unpack() + asmlib.SetAsmConvar(oPly,"nextpic", nextpic) + asmlib.SetAsmConvar(oPly,"nextyaw", nextyaw) + asmlib.SetAsmConvar(oPly,"nextrol", nextrol) + end tC.Node[mD]:Set(tData.Org) tC.Norm[mD]:Set(tData.Ang:Up()) tC.Base[mD]:Set(tData.Hit)