Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- b1 = box(pos = vector(-10, 4, 0), size = vector(0.5,7,7), color = color.orange)
- b2 = box(pos = vector(-10, -4, 0), size = vector(0.5,7,7), color = color.orange)
- emitter = box(pos = vector(-25, 0, 0), size = vector(3,3,3), color = color.white)
- top = box(pos = vector(5,8,0), size = vector(10,0.5,10), color = color.red)
- bottom = box(pos = vector(5,-8,0), size = vector(10,0.5,10), color = color.blue)
- screen = box(pos = vector(18, 0,0), size = vector(0.5,20,20), color =color.green)
- ball = sphere(pos = vector(-25,0,0), size = vector(0.5,0.5,0.5), color = color.yellow)
- t = attach_trail(ball)
- height = 5
- width = 5
- h = hit = cylinder(pos = vector(18, height, width), size = vector(1.1, 1, 1), axis = vector(1,0,0), color = color.black)
- frames = 30
- dt = 1.0 / frames
- e = 1.6e-16
- m = 10e-30
- d = 16
- Uy = -10
- Uz = 0.8
- Ustart = 400
- Flaeche = 10 * 10
- epsilonnull = 0.0000000000088541
- epsilonr = 1.0
- Feldy = Uy / d
- Feldz = Uz / d
- ay = (Uy / d * e) / m
- ay = ay * 10e-14
- az = (Uz / d * e) / m
- az = az * 10e-14
- aStart = (4 * e * Ustart * 8) / m
- aStart = aStart * 10e-18
- vx = 0.7
- vy = 0
- vz = 0
- while True:
- rate(frames)
- if ball.pos.x <-6:
- ball.pos.x = ball.pos.x + vx * dt
- ball.pos.y = ball.pos.y + vy * dt
- ball.pos.z = ball.pos.z + vz * dt
- vx = vx + aStart * dt
- else if ball.pos.x < 0:
- ball.pos.x = ball.pos.x + vx * dt
- ball.pos.y = ball.pos.y + vy * dt
- ball.pos.z = ball.pos.z + vz * dt
- else if ball.pos.x <10:
- ball.pos.x = ball.pos.x + vx * dt
- ball.pos.y = ball.pos.y + vy * dt
- ball.pos.z = ball.pos.z + vz * dt
- vy = vy + ay * dt
- vz = vz + az * dt
- h.pos.x = 18
- else if ball.pos.x < 17.7:
- ball.pos.x = ball.pos.x + vx * dt
- ball.pos.y = ball.pos.y + vy * dt
- ball.pos.z = ball.pos.z + vz * dt
- else if ball.pos.x > 17.7:
- vx = 0
- vy = 0
- vz = 0
- h.pos = ball.pos
- h.pos.x = 17.4
- t.stop()
- t.clear()
- ball.pos = vector(-15,0,0)
- t.start()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement