-
What do you want to achieve? Keep it simple and clear!
I want to achieve an effect where the left arm can properly point to a LeftGrip, such as a Grip gun attachment or the barrel. -
What is the issue? Include screenshots / videos if possible!
The issue is that the angle that is produced is causing an undesirable roll effect on the arm, which looks unnatural.
-
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I already tried removing the Z axis entirely, but that only created more issues.
Here is the main update loop function:
Connect(function(dt) -- Main update function
if (this_WeaponModel and #this_Viewport > 0) then
local Left_Arm, Right_Arm = this_Viewport[1], this_Viewport[2]
Left_Arm.CFrame, Right_Arm.CFrame = Workspace.CurrentCamera.CFrame * Settings.LeftArmPos, Workspace.CurrentCamera.CFrame * Settings.RightArmPos
this_WeaponModel:SetPrimaryPartCFrame(Right_Arm.CFrame * CFrame.new(Right_Arm.Size.X/2, 0, 0) * Settings.WeaponOffset)
local find = this_WeaponModel:FindFirstChild(tostring(WeaponModel:GetAttribute("SecondaryPart")))
if (find) then
Left_Arm.CFrame = CFrame.new(Left_Arm.Position, find.Position) * CFrame.Angles(0, math.pi/2, 0) * CFrame.new(math.clamp((Left_Arm.Position - find.Position).Magnitude/2, -Left_Arm.Size.X/2, Left_Arm.Size.X/2), 0, 0)
end
end
end, RunService.RenderStepped)