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

What math topics do i need to learn in order to script cframe interpolation?

What math topics do i need to learn in order to script cframe interpolation?

1 comment

0

Linear Interpolation, commenting because I haven't used this for interpolation but I know it is a method of it.

1 answer

I've played around with CFrame interpolation for a while, and this is a simple example of using a cos interp between two positions;

for i = 1, t do
	wait()	
	local f = i/t *pi
	local g = (1-math.cos(f)) * 0.5
	Part.CFrame = CFrame.new(X1, Y1, Z1)  
	*CFrame.new(g*(X2-X1), g*(Y2-Y1), g*(Z2-Z1))
end

X1, Y2, Z2 mark the initial location, while X2, Y2, Z2 mark the position you're aiming for. If you need help understanding how the math works, feel free to ask.

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