I am making a FPS Gun System with R15 IK and the Guns get welded with M6D’S to the HumanoidRootPart when the Gun is equipped.
But when i calculate the angle between the lookvector of the HRP and the Lookvector of the Camera and i look down, it rotates up, i look up, and it rotates up. You see what the problem is? Also if someone is extra cool tell me how to make it smooth with lerp.
AND ALSO there is problem that when i rotate to the right and to the left it rotates.
armsRE:Connect(function(plr, cameraCF :CFrame)
if equipped then
local root :BasePart = plr.Character:WaitForChild("HumanoidRootPart")
local lookVector = cameraCF.LookVector
local angle = lookVector:Angle(root.CFrame.LookVector, root.CFrame.LookVector.Unit)
if angle > 0 then
config.m6D.C1 = CFrame.new(config.m6D.C1.Position) * CFrame.Angles(0, 0, -angle)
else
config.m6D.C1 = CFrame.new(config.m6D.C1.Position) * CFrame.Angles(0, 0, angle)
end
end
end)