Advertisement
Guest User

Untitled

a guest
May 26th, 2017
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.59 KB | None | 0 0
  1. local points = {}
  2.  
  3. local material = Material("cable/rope")
  4. local entity = nero.GetPlayer("CapsAdmin")
  5.  
  6. local length = 20
  7.  
  8. for point = 1, length do
  9.     points[point] = {position = entity:GetShootPos(), velocity = Vector(0)}
  10. end
  11.  
  12. --GARBAGE CPOERLERLECOTR
  13. local Clamp = math.Clamp
  14. local Max = math.max
  15. local Vector = Vector
  16. local Draw = draw.SimpleText
  17.  
  18. hook.Add("RenderScreenspaceEffects", "RopePhysics:RenderScreenspaceEffects", function()
  19.  
  20.     cam.Start3D(EyePos(), EyeAngles())
  21.         render.SetMaterial(material)
  22.         render.StartBeam(length)
  23.             for point = 1, length do
  24.                 render.AddBeam(points[point].position,1,1,color_white)
  25.             end
  26.         render.EndBeam()
  27.     cam.End3D()
  28.  
  29.  
  30.     points[1].position = entity:GetShootPos() + (entity:GetAimVector() * 100)
  31.  
  32.     for point = 1, length do
  33.         local position1 = points[Clamp(point-1, 1, length)].position - points[point].position
  34.         local magnitude1 = position1:Length()
  35.         local extension1 = magnitude1 - 10
  36.         print()
  37.        
  38.         local position2 = points[Clamp(point+1, 1, length)].position - points[point].position
  39.         local magnitude2 = position2:Length()
  40.         local extension2 = magnitude2 - 10
  41.        
  42.         local velocity = (position1 / magnitude1 * extension1) + (position2 / magnitude2 * extension2) + (Vector(0,0,0) * 0.0001)
  43.  
  44.         points[point].velocity = points[point].velocity * (velocity * 0.001)
  45.         points[point].position = points[point].position + points[point].velocity
  46.        
  47.         local pos = points[point].position:ToScreen()
  48.         Draw(  point,  "ScoreboardText",  pos.x,  pos.y,  color_white,  0,  0 )
  49.     end
  50.  
  51. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement