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

RenderStepped Isn't Fast Enough?

Asked by
Hibobb 40
9 years ago

I have this code with a side scroller camera script to constantly place the Scriptable type camera in along side the plane. It shakes a lot while moving so I added the prints to see whats happening. When it prints the X values are almost 4 studs off! How do I stop this? The plane is not moving incredibly fast, a little more than a 16 walkspeed. It works fine in Play Solo and is in a localscript inside the character. The plane is also a part of the character model.

Output:

302.421356, 26.0971069, 94.5161667 Plane 298.571777, 29.1924076, 134.515503 Cam

game:GetService("RunService").RenderStepped:connect(function()
if viewpos ~= plane.View.Position then
    print(plane.View.Position,"Plane")
    print(cam.CoordinateFrame.p,"Cam")
    cam.CoordinateFrame = CFrame.new(plane.View.CFrame.p + Vector3.new(0, 2, 40),plane.View.CFrame.p)
viewpos = plane.View.Position
end
end)

Answer this question