My OTS Camera system works fine however there is small bug that makes the character jitter for some reason.
Here you can see what is happening (it seems the less offset the less jitter):
Offset of (1, 1, 0): - No visible jitter
Offset of (5, 5, 0): - Some jiter
Offset of (10, 10, 0): - More jitter
I have looked for a long time for a solution but I each time I try something else it just has the same result.
This is basically what my code is for the system (in a module in ReplicatedStorage):
local CameraEffects = {}
local Player = game.Players.LocalPlayer
local RunService = game:GetService("RunService")
local TweenService = game:GetService("TweenService")
local UserInputService = game:GetService("UserInputService")
local CameraUtils = require(Player.PlayerScripts:WaitForChild("PlayerModule"):WaitForChild("CameraModule"):WaitForChild("CameraUtils"))
local Camera = game.Workspace.CurrentCamera
-- OTS
local TweenOTS = false
function CameraEffects.OTS(Offset)
CameraUtils.setRotationTypeOverride(Enum.RotationType.CameraRelative)
UserInputService.MouseBehavior = Enum.MouseBehavior.LockCenter
Player.Character.Humanoid.AutoRotate = false
Camera:GetPropertyChangedSignal("CFrame"):Connect(function()
Player.Character.HumanoidRootPart.CFrame = CFrame.new(Player.Character.HumanoidRootPart.CFrame.p, Player.Character.HumanoidRootPart.CFrame.p + Vector3.new(Camera.CFrame.lookVector.X, 0, Camera.CFrame.lookVector.Z));
end)
RunService.RenderStepped:Connect(function()
if Player.Character:FindFirstChild("HumanoidRootPart") then
if TweenOTS == false then
TweenOTS = TweenService:Create(Player.Character.Humanoid, TweenInfo.new(1) , {CameraOffset = Offset})
TweenOTS:Play()
TweenOTS.Completed:Connect(function()
TweenOTS = false
end)
end
end
end)
end