Advertisement
oopsrainbow4

Projectile Physics

Jul 22nd, 2022
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.64 KB | None | 0 0
  1. while true do
  2.     task.wait(2)
  3.    
  4.     local position1 = workspace.From.Position
  5.     local position2 = workspace.To.Position
  6.  
  7.     local direction = position2 - position1
  8.     local duration = math.log(1.001 + direction.Magnitude * 0.01)
  9.     position2 = workspace.To.Position + workspace.To.AssemblyLinearVelocity * duration
  10.     direction = position2 - position1
  11.     local force = direction / duration + Vector3.new(0,game.Workspace.Gravity * duration / 2, 0)
  12.    
  13.     print(duration)
  14.    
  15.     local clone = game.ServerStorage.Projectile:Clone()
  16.     clone.Position = position1
  17.     clone.Parent = workspace
  18.     clone:ApplyImpulse(force * clone.AssemblyMass)
  19.     clone:SetNetworkOwner(nil)
  20. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement