Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local function Lerp(Start,End,Ratio)
- return Start + (End - Start)*Ratio
- end
- local function LerpCFrame(Start,End,Ratio)
- local X1,Y1,Z1,A1,B1,C1,D1,E1,F1,G1,H1,I1 = Start:components()
- local X2,Y2,Z2,A2,B2,C2,D2,E2,F2,G2,H2,I2 = End:components()
- return CFrame.new(
- Lerp(X1,X2,Ratio),Lerp(Y1,Y2,Ratio),Lerp(Z1,Z2,Ratio),
- Lerp(A1,A2,Ratio),Lerp(B1,B2,Ratio),Lerp(C1,C2,Ratio),
- Lerp(D1,D2,Ratio),Lerp(E1,E2,Ratio),Lerp(F1,F2,Ratio),
- Lerp(G1,G2,Ratio),Lerp(H1,H2,Ratio),Lerp(I1,I2,Ratio)
- )
- end
- --
- local t0 = tick();
- local t = t0;
- local dur = 10;
- local Part0 = Instance.new("Part", Workspace);
- Part0.Anchored = true;
- local c0 = CFrame.new(-6.19999981, 17.8999996, -11.6000004, -0.789149165, 0.305518985, -0.532824039, 0.265162319, -0.613030255, -0.744232535, -0.554014564, -0.728595555, 0.402760237);
- local cfinal = CFrame.new(0, 4, 0);
- local c;
- while t-t0<dur do
- c = LerpCFrame(c0, cfinal, (t-t0)/dur);
- local x, y, z, m00,m01,m02,m10,m11,m12,m20,m21,m22 = c:components();
- local d = m00*(m11*m22-m12*m21)-m01*(m10*m22-m12*m20)+m02*(m10*m21-m11*m20);
- Part0.CFrame = c;
- if d<0.01 then print(Part0.CFrame:inverse()*c); local dt = wait(0.1); t0=t0+dt;t=t+dt; end
- t = t + wait();
- end
- Part0.CFrame = cfinal;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement