Python Physics Simulation. Galton Board. Pymunk Tutorial

แชร์
ฝัง
  • เผยแพร่เมื่อ 26 ก.ค. 2024
  • Python Tutorial on Physics Simulations using the Pymunk engine and the Pygame library. In this video we will recreate the Galton board experiment.
    More Python Projects: • Python Projects
    SourceCode:
    github.com/StanislavPetrovV/P...
    #coderspace #python #pymunk #pygame #galtonboard
    #programming #coding #programmer #developer #technology #code

ความคิดเห็น • 17

  • @spinlizard1
    @spinlizard1 ปีที่แล้ว +2

    Your tutorials are fantastic. I have learned so much from them. Thanks for doing them.

  • @agentzero3209
    @agentzero3209 8 หลายเดือนก่อน

    thank you so much for sharing your experience and code in your videos. It helped me a lot in understanding several programming concepts and solutions.

  • @almircampos
    @almircampos ปีที่แล้ว

    Very (VERY!) good tutorial. Thank you!!!

  • @800kpygame2
    @800kpygame2 ปีที่แล้ว

    I couldn't learn pymunk due to lack of resources but I started learning with your video thank you

  • @User_bird_0
    @User_bird_0 2 ปีที่แล้ว

    WHO R U GETTING JUST 225 views
    man you make the perfect videos
    keep it up

  • @paulthomas1052
    @paulthomas1052 ปีที่แล้ว

    Interesting tutorial. Thanks :)

  • @frutellasweet2474
    @frutellasweet2474 ปีที่แล้ว

    Great!

  • @jntb3000
    @jntb3000 ปีที่แล้ว +1

    I follow the code exactly, but after adding elasticity, the ball does not bounce up at all. It just falls downward and stucks to floor. (The added friction changed the horizontal lines like in your demo.) Thanks for the great video. I've learned a lot.

  • @huytranvan2754
    @huytranvan2754 2 ปีที่แล้ว

    Here before your channel grows big!

  • @user-lo2qv8wz8f
    @user-lo2qv8wz8f ปีที่แล้ว

    BIG LOVE

  • @jntb3000
    @jntb3000 ปีที่แล้ว

    my bad, small typo. Your code works perfectly

  • @ChrisWMF
    @ChrisWMF 2 ปีที่แล้ว +1

    Is it OK for me to copy your code so I can play around with this stuff and learn it?

    • @CoderSpaceChannel
      @CoderSpaceChannel  2 ปีที่แล้ว +1

      Yes, you can do whatever you want with this code. But comply with the MIT license

  • @matthewcanify
    @matthewcanify ปีที่แล้ว +1

    How long have you been coding for ?

  • @scpf2360
    @scpf2360 ปีที่แล้ว

    Why won't it work:
    import pygame as pg
    import pymunk.pygame_util
    pymunk.pygame_util.positive_y_is_up = False
    RES = WIDTH, HEIGHT = 1200, 1000
    FPS = 60
    pg.init()
    surface = pg.display.set_mode(RES)
    clock = pg.time.clock()
    draw_options = pygame.pymunk_util.DrawOptions(surface)
    space = pymunk.Space()
    space.gravity = 0, 2000
    ball_mass, ball_radius = 1, 60
    ball_moment = pymunk.moment_for_circle(ball_mass, 0, ball_radius)
    ball_body = pymunk.Body(ball_mass, ball moment)
    ball_body.position = WIDTH // 2, 0
    ball_shape = pymunk.Circle(ball_body, ball_radius)
    space.add(ball_body, ball_shape)
    while True:
    surface.fill(pg.color('black'))
    for i in pg.event.get():
    if i.type == pg.quit:
    exit()
    space.step(1 / FPS)
    space.debug_draw(draw_options)
    pg.display.flip()
    clock.tick(FPS)
    This Code Was Unfinished Because I'm Just Testing
    the Warning:
    File "/data/user/0/ru.iiec.pydroid3/files/temp_iiec_codefile.py", line 18
    ball_body = pymunk.Body(ball_mass, ball moment)
    ^
    SyntaxError: invalid syntax