Advertisement
Guest User

Untitled

a guest
Feb 19th, 2020
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.07 KB | None | 0 0
  1.  
  2. b1 = box(pos = vector(-10, 4, 0), size = vector(0.5,7,7), color = color.orange)
  3. b2 = box(pos = vector(-10, -4, 0), size = vector(0.5,7,7), color = color.orange)
  4.  
  5.  
  6. emitter = box(pos = vector(-25, 0, 0), size = vector(3,3,3), color = color.white)
  7.  
  8.  
  9. top = box(pos = vector(5,8,0), size = vector(10,0.5,10), color = color.red)
  10. bottom = box(pos = vector(5,-8,0), size = vector(10,0.5,10), color = color.blue)
  11.  
  12.  
  13.  
  14. screen = box(pos = vector(18, 0,0), size = vector(0.5,20,20), color =color.green)
  15.  
  16.  
  17. ball = sphere(pos = vector(-25,0,0), size = vector(0.5,0.5,0.5), color = color.yellow)
  18. t = attach_trail(ball)
  19.  
  20. height = 5
  21. width = 5
  22. h = hit = cylinder(pos = vector(18, height, width), size = vector(1.1, 1, 1), axis = vector(1,0,0), color = color.black)
  23.  
  24.  
  25. frames = 30
  26. dt = 1.0 / frames
  27.  
  28.  
  29. e = 1.6e-16
  30. m = 10e-30
  31. d = 16
  32. Uy = -10
  33. Uz = 0.8
  34. Ustart = 400
  35.  
  36.  
  37. Flaeche = 10 * 10
  38. epsilonnull = 0.0000000000088541
  39. epsilonr = 1.0
  40.  
  41. Feldy = Uy / d
  42. Feldz = Uz / d
  43.  
  44. ay = (Uy / d * e) / m
  45. ay = ay * 10e-14
  46.  
  47. az = (Uz / d * e) / m
  48. az = az * 10e-14
  49.  
  50. aStart = (4 * e * Ustart * 8) / m
  51. aStart = aStart * 10e-18
  52.  
  53. vx = 0.7
  54. vy = 0
  55. vz = 0
  56.  
  57.  
  58. while True:
  59. rate(frames)
  60.  
  61. if ball.pos.x <-6:
  62.  
  63. ball.pos.x = ball.pos.x + vx * dt
  64. ball.pos.y = ball.pos.y + vy * dt
  65. ball.pos.z = ball.pos.z + vz * dt
  66.  
  67. vx = vx + aStart * dt
  68.  
  69. else if ball.pos.x < 0:
  70.  
  71. ball.pos.x = ball.pos.x + vx * dt
  72. ball.pos.y = ball.pos.y + vy * dt
  73. ball.pos.z = ball.pos.z + vz * dt
  74.  
  75. else if ball.pos.x <10:
  76.  
  77. ball.pos.x = ball.pos.x + vx * dt
  78. ball.pos.y = ball.pos.y + vy * dt
  79. ball.pos.z = ball.pos.z + vz * dt
  80.  
  81. vy = vy + ay * dt
  82. vz = vz + az * dt
  83.  
  84. h.pos.x = 18
  85.  
  86. else if ball.pos.x < 17.7:
  87.  
  88. ball.pos.x = ball.pos.x + vx * dt
  89. ball.pos.y = ball.pos.y + vy * dt
  90. ball.pos.z = ball.pos.z + vz * dt
  91.  
  92. else if ball.pos.x > 17.7:
  93.  
  94. vx = 0
  95. vy = 0
  96. vz = 0
  97.  
  98. h.pos = ball.pos
  99. h.pos.x = 17.4
  100.  
  101. t.stop()
  102. t.clear()
  103. ball.pos = vector(-15,0,0)
  104. t.start()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement