I am trying to make a camera system for my roblox flight game, but it has several glitches to it, and doesn’t feel as smooth as how I would want it to be. Example video of me just flying around the test place:
https://filebin.net/4hq4llkrwrrsrxq2/20240309-1816-29.5879427.mp4
Camera Code:
while task.wait() do
local Plane = Player.Character:FindFirstChildOfClass("Model")
if Plane then
local Main = Plane:FindFirstChild("Main")
local Mouse = Player:GetMouse()
Mouse.TargetFilter = Plane
local MainCframe = CFrame.lookAt(Main.Position,Mouse.Hit.Position)
if CanManveur == true then
Events.MouseHitPos:FireServer(Mouse.Hit.Position)
local rx, ry, rz = MainCframe.Rotation:ToOrientation()
local Tween1 = TweenService:Create(script.CameraOrientation,TweenInfoNew,{Value = Vector3.new(rx,ry,rz)})
local CameraPosCframe = CFrame.new((Main.Position-(Main.CFrame.LookVector*Main.Configuration.Camera.CameraBack.Value))+(Main.CFrame.UpVector*Main.Configuration.Camera.CameraUp.Value))
workspace.CurrentCamera.CFrame = CameraPosCframe * CFrame.Angles(script.CameraOrientation.Value.x,script.CameraOrientation.Value.Y,script.CameraOrientation.Value.Z)
Tween1:Play()
end
end
end
This video is a example of what I would want it to be.