Advertisement
StefanBashkir

Connect Two Parts by an Arc

Mar 14th, 2015
224
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.65 KB | None | 0 0
  1. local Start = workspace.s.Position
  2. local End = workspace.e.Position
  3. local Distance = (End - Start).magnitude;
  4. local Direction = (End - Start).unit;
  5. local Parts = 100;
  6. local Increment = Distance/Parts;
  7. local AmountOfArcs = 1
  8. local Amplitude = 5
  9.  
  10. for i = 0, Parts do
  11.     local P = Instance.new("Part");
  12.     local PercentOfCompletion = i/Parts;
  13.     local PercentOfSineWave = math.sin(((math.pi*AmountOfArcs) * PercentOfCompletion)) * Amplitude;
  14.     local YAdjustment = PercentOfSineWave * 10
  15.     P.Anchored = true;
  16.     P.Size = Vector3.new(1,1,1);
  17.     P.CFrame = CFrame.new(Start) + (Direction * (Increment * i)) + Vector3.new(0,YAdjustment,0);
  18.     P.Parent = workspace
  19. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement