Recently when playing around with my weapon + attachment system I’ve noticed that during ADS my weapon model “gravitates” towards horizon / temporarily locks on 0 height when the camera points close to it.
This is very annoying as it makes aiming precisely with long range scopes towards objects close to players head height almost impossible.
Code that rotates players arms: (Runs on renderstepped, BaseLeft/RightC0 is the default CFrame for arms)
--On client
local Angle, _, _ = Camera.CFrame:ToOrientation()
--On server
local RX, RY, _ = BaseRightC0.Rotation:ToEulerAnglesXYZ()
local LX, LY, _ = BaseLeftC0.Rotation:ToEulerAnglesXYZ()
Character.Torso["Right Shoulder"].C0 = CFrame.new(BaseRightC0.Position) * CFrame.Angles(RX, RY, Angle)
Character.Torso["Left Shoulder"].C0 = CFrame.new(BaseLeftC0.Position) * CFrame.Angles(LX, LY, -Angle)
I’ve done some research and it seemed like its gimbal lock so I’ve tried using quarternions but I dont really fully get them so no luck so far.
Angle variable seems to have proper values (Both when in and out of “the lock”)
Any help would be greatly appreciated ;D