Advertisement
suremarc

Untitled

Jun 8th, 2015
268
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.21 KB | None | 0 0
  1. local function Lerp(Start,End,Ratio)
  2. return Start + (End - Start)*Ratio
  3. end
  4. local function LerpCFrame(Start,End,Ratio)
  5. local X1,Y1,Z1,A1,B1,C1,D1,E1,F1,G1,H1,I1 = Start:components()
  6. local X2,Y2,Z2,A2,B2,C2,D2,E2,F2,G2,H2,I2 = End:components()
  7. return CFrame.new(
  8. Lerp(X1,X2,Ratio),Lerp(Y1,Y2,Ratio),Lerp(Z1,Z2,Ratio),
  9. Lerp(A1,A2,Ratio),Lerp(B1,B2,Ratio),Lerp(C1,C2,Ratio),
  10. Lerp(D1,D2,Ratio),Lerp(E1,E2,Ratio),Lerp(F1,F2,Ratio),
  11. Lerp(G1,G2,Ratio),Lerp(H1,H2,Ratio),Lerp(I1,I2,Ratio)
  12. )
  13. end
  14. --
  15.  
  16. local t0 = tick();
  17. local t = t0;
  18. local dur = 10;
  19. local Part0 = Instance.new("Part", Workspace);
  20. Part0.Anchored = true;
  21. 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);
  22. local cfinal = CFrame.new(0, 4, 0);
  23. local c;
  24. while t-t0<dur do
  25. c = LerpCFrame(c0, cfinal, (t-t0)/dur);
  26. local x, y, z, m00,m01,m02,m10,m11,m12,m20,m21,m22 = c:components();
  27. local d = m00*(m11*m22-m12*m21)-m01*(m10*m22-m12*m20)+m02*(m10*m21-m11*m20);
  28. Part0.CFrame = c;
  29. if d<0.01 then print(Part0.CFrame:inverse()*c); local dt = wait(0.1); t0=t0+dt;t=t+dt; end
  30. t = t + wait();
  31. end
  32. Part0.CFrame = cfinal;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement