#Viewport Camera is jittery

1 messages · Page 1 of 1 (latest)

steep snow
#

Been trying to make an orbit camera inside a viewport frame, and I got it working but the movement of the camera is really jittery and can lag behind when the player is moving their camera too quickly. I think it has something to do with the LookVector, but I'm not sure.

The code I'm using:

local RunService = game:GetService("RunService")

local Viewport = script.Parent.ViewportFrame
local playerCamera = workspace.CurrentCamera

local vpfCamera = Instance.new("Camera") --Creates new Camera
vpfCamera.Parent = Viewport --Sets it inside the VPF
Viewport.CurrentCamera = vpfCamera --Sets the VPF's Current Camera to it

local offsetDistance = 128

RunService.Heartbeat:Connect(function()
    --local mag = (Vector3.new(0,0,0) - playerCamera.CFrame.Position).Magnitude
    local thing = vpfCamera.CFrame.LookVector*-offsetDistance --I have no idea what to call this
    
    vpfCamera:PivotTo(CFrame.new(thing)*playerCamera.CFrame.Rotation)


end)
granite tiger
dreamy kettle
#

damn cool effect

steep snow
steep snow
gloomy pondBOT
#

studio** You are now Level 3! **studio

steep snow
#

it has the slightest bit of jitteriness and its so annoying T_T

rare dome
#

Try in PreRender

#

I don't remember if thats the same as RenderStepped but its where you should be doing it

steep snow