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

Is there a way to turn a part smoothly, just like it moves smoothly using bodyposition?

Asked by 6 years ago

You know when you use bodyposition to move a part to a spot, it glides through the air.

1 answer

Log in to vote
1
Answered by
hellmatic 1523 Moderation Voter
6 years ago

You can use CFrame lerp.

local Pos1 = CFrame.new() -- Start position
local Pos2 = CFrame.new(Vector3.new(10, 10, 10)) -- End position

for i = 0, 1, 0.01 do
    Part.CFrame = Pos1:lerp(Pos2, i) -- transitions the part from Pos1 to Pos2
    wait()
end

0
this method can work on unanchored and anchored parts. hellmatic 1523 — 6y
Ad

Answer this question