Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

RenderStepped Is Too Slow?

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)

1 comment

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.

1 answer

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

2 comments

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

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"

This discussion is preserved as it was. New answers, comments, and votes are closed.