Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Camera Shake happens as I move the camera in a loop?

Asked by
zyrun 168
6 years ago

I have a cut-scene type of thing where the camera is looking at a walking NPC and continues to look at it while also moving. After doing that, the camera moves and is stationary. The problem occus when I am moving the camera in the loop. The camera is constantly shaking along the Y axis if you were to split the screen into a grid.

local camera = workspace.CurrentCamera
camera.CameraType = Enum.CameraType.Scriptable
local target = game.Workspace:WaitForChild("NPC").HumanoidRootPart
local part = game.Workspace:WaitForChild("PartToLookAt")

for i = 2, 19, .1 do
    if i < 14 then --Stops moving forward, only up a little bit.
        camera.CFrame = CFrame.new(Vector3.new((part.Position.X - 50) +(part.Position.Y + i), part.Position.Z),(Vector3.new(target.Position)))
    else
        camera.CFrame = CFrame.new(Vector3.new(camera.CFrame.p.X ,(i),0),(Vector3.new(target.Position)))    
    end 
    wait()
end
wait(.1)        
camera.CFrame = CFrame.new(Vector3.new((part.Position.X - 12),(part.Position.Y + 7),part.Position.Z - .4),(Vector3.new(target.Position)))

Notes: This is a Local Script in the player, Problem doesn't occur in single player (Yes I have FE on)

0
Another Note: The problem isn't predictable. It happens at random intervals and stops at random intervals too zyrun 168 — 6y

1 answer

Log in to vote
0
Answered by
dispeller 200 Moderation Voter
6 years ago

You might have to use tween service

Ad

Answer this question