DrawingJhon

Temp

Dec 14th, 2021 (edited)
562
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.96 KB | None | 0 0
  1. local model = Instance.new("Model", script)
  2. local mass = 1
  3. local force = 50
  4. local g = workspace.Gravity
  5. local radians = math.rad(45)
  6.  
  7. local unitX = math.cos(radians)
  8. local unitY = math.sin(radians)
  9.  
  10. local vX = force * unitX
  11. local vY = force * unitY
  12.  
  13. local lastPoint = nil
  14.  
  15. local function makePointAt(x, y)
  16.     if lastPoint then
  17.         lastPoint.BrickColor = BrickColor.new("Gray")
  18.         lastPoint.Size = Vector3.new(1, 1, 1)
  19.     end
  20.     local point = Instance.new("Part")
  21.     point.BrickColor = BrickColor.new("Bright green")
  22.     point.Anchored = true
  23.     point.TopSurface, point.BottomSurface = "Smooth", "Smooth"
  24.     point.Shape = "Ball"
  25.     point.Size = Vector3.new(2, 2, 2)
  26.     point.Position = Vector3.new(x, y + 5, 0)
  27.     point.Parent = model
  28.     if lastPoint then
  29.         print((lastPoint.Position - point.Position).magnitude)
  30.     end
  31.     lastPoint = point
  32. end
  33.  
  34. for t = 0.05, 3, 0.05 do
  35.     task.wait(0.05)
  36.     local pX = 0 + vX * t
  37.     local pY = 0 + vY * t - 1/2 * g * (t^2)
  38.     makePointAt(pX, pY)
  39. end
Add Comment
Please, Sign In to add comment