I’m currently scripting a custom camera system right now that smoothly moves the camera based on your mouse position, and currently have most of it scripted. However, an issue I currently have is that the camera would spaz out like crazy whenever I move my mouse around extremely fast.
https://gyazo.com/8a48db6f6e7a58902f9f70bc94a9f8ca.mp4
Here is the code that calculates the CFrame that the camera would move to:
local offset = Values.Offset
local originCFrame = CFrame.new(rootPart.CFrame.p + Vector3.new(0, 3, 0)) * CFrame.Angles(0, math.rad(Values.AngleX), 0) * CFrame.Angles(math.rad(Values.AngleY), 0, 0)
local newCFrame = originCFrame + originCFrame:VectorToWorldSpace(Vector3.new(offset.X, offset.Y, offset.Z))
local goalCFrame = originCFrame + originCFrame:VectorToWorldSpace(Vector3.new(offset.X, offset.Y, 0))
local finalCFrame = CFrame.new(newCFrame.p, goalCFrame.p)
Right now, the only potential solution I am aware that could fix this issue would be to othernormalize the cframe, however, I am not sure how to properly apply that to the script.