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
7 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.

01local camera = workspace.CurrentCamera
02camera.CameraType = Enum.CameraType.Scriptable
03local target = game.Workspace:WaitForChild("NPC").HumanoidRootPart
04local part = game.Workspace:WaitForChild("PartToLookAt")
05 
06for i = 2, 19, .1 do
07    if i < 14 then --Stops moving forward, only up a little bit.
08        camera.CFrame = CFrame.new(Vector3.new((part.Position.X - 50) +(part.Position.Y + i), part.Position.Z),(Vector3.new(target.Position)))
09    else
10        camera.CFrame = CFrame.new(Vector3.new(camera.CFrame.p.X ,(i),0),(Vector3.new(target.Position)))   
11    end
12    wait()
13end
14wait(.1)       
15camera.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 — 7y

1 answer

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

You might have to use tween service

Ad

Answer this question