So, the issue Im having Is that, the “head” will rotate a complete 360 circle once you switch between 3/-3 in radians.
Heres a clip of the undesired effect in action.
Does anyone have any clue as to what I could do to fix the 360 “flip”?
Here’s my code
local x = mse.X-middle_screen.X
local y = mse.Y-middle_screen.Y
local normalized = Vector3.new(x,y,0).Unit
xy = Vector2.new(normalized.X,normalized.Y)
object_yaw_angle = math.atan2(xy.X,xy.Y)
local normalized_object_yaw_angle = -math.floor(math.deg(-object_yaw_angle)) - 90
part:PivotTo(CFrame.new(zero.Position+(movevector*zero.Size.Z/4))*CFrame.fromEulerAnglesXYZ(0, math.rad((Vector3.new(0,dampenedangle,0)).Y), 0))