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

How do you "smoothly" change a parts position from one point to another?

Asked by
bIujay 0
9 years ago

I'm using camera manipulation and the camera is on a part. I want the block to move smoothly from point A to point B where there are no skips or signs of "choppyness"

Help Please?

0
Try using a for loop to CFrame the part gradually to it's desired position. Discern 1007 — 9y

1 answer

Log in to vote
0
Answered by
1waffle1 2908 Trusted Badge of Merit Moderation Voter Community Moderator
9 years ago

The only way to "remove" choppyness is to have the program running on your computer. If it runs on the server then there will be a network delay. If its physics network ownership is on someone else's computer then there will be two network delays plus however bad their computer might be.

If it's just running on your computer then interpolating CFrames would be fine:

local velocity=50
local c1=CFrame.new()
local c2=CFrame.new(10,10,10)

local stepped=game:GetService("RunService").RenderStepped
for i=0,1,(c1.p-c2.p).magnitude/(velocity*60) do
    Part.CFrame=c1:lerp(c2,i)
    stepped:wait()
end
0
Thanks man! bIujay 0 — 9y
Ad

Answer this question