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

RenderStepped Is Too Slow?

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)
0
No one can really answers this, because we don't know what the variables equal. I would forget the math if I were you, however. Just get the Part in the correct position, then set the CoordinateFrame of the camera to the Part's CFrame. Perci1 4988 — 9y

1 answer

Log in to vote
0
Answered by 9 years ago

Try setting the camera to a tracking mode of sorts and lock it to the part you want it to follow.

0
A tracking mode? I'm confused by what you mean. This is essentially tracking the part, while at the same time preventing the player from moving the camera around Hibobb 40 — 9y
0
Try taking using the line of code: cam.CameraSubject = player.Character.plane.View; change the variables as needed, and make the cam variable equal to the currentcamera, this will lock the camera to follow the part. Also use this code to lock the camera in the direction of the block: cam.CameraType = "Attach" legobuildermaster 220 — 9y
Ad

Answer this question