Rotating part around camera looks laggy

Whenever I’m trying to rotate part with Cam * Angle + Offset, it is looking kind of laggy and doesn’t stay in one place when flicked with mouse.

Full Script:

local part = workspace.Part
local cam = workspace.CurrentCamera

game:GetService("RunService").PreRender:Connect(function()
	part.CFrame = cam.CFrame * CFrame.Angles(1,0,0) + part.CFrame.LookVector
end)

Video:

1 Like

Try setting PhysicsSteppingMethod workspace property to adaptive.

Nothing changed, still the same issue.

Figured this out:
So apparently you have to set before and after render.

Updated script:

local part = workspace.Part
local cam = workspace.CurrentCamera

game:GetService("RunService").PreRender:Connect(function()
	part.CFrame = cam.CFrame * CFrame.Angles(1,0,0) + part.CFrame.LookVector
end)
--order does not matter
game:GetService("RunService").RenderStepped:Connect(function()
	part.CFrame = cam.CFrame * CFrame.Angles(1,0,0) + part.CFrame.LookVector
end)
1 Like

While this does work, may I recommend just using renderstepped?
Afaik prerender runs before physic simulation
RenderStepped is on every frame render so if you do that then the part will be there instantly on the camera rendering out a frame regardless.
There is NO reason to do two loops.

Tried and same effect as if single PreRender or RenderStepped.

Wasn’t supposed to be any difference its just I don’t see a need for you to being doing two separate loops, its not a huge performance hitch but if you can save FPS then save it where you can.

Sure, but it doesn’t fix the bug of snappy movement.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.