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

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

Asked by 9 years ago

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

0
Linear Interpolation, commenting because I haven't used this for interpolation but I know it is a method of it. YellowoTide 1992 — 9y

1 answer

Log in to vote
1
Answered by
saenae 318 Moderation Voter
9 years ago

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.

Ad

Answer this question