Log In  


Cart #orbittest-0 | 2021-12-17 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA

orbiting particles



I liked the combination of gravity with bouncy walls - not a combination I've seen before! So I reworked the physics a little:

  • Make orbital mechanics a bit more realistic (remove tangential component of acceleration)
  • Initialize velocities to produce orbits that are closer to circular, on average
  • Conserve energy on collision with walls
  • Initialize starting positions uniformly across the screen
  • Smaller timestep for less frenetic motion

Things that aren't present but might be fun to add:

  • particle-particle interactions (maybe both gravity and collision?)
  • hacks to make sure energy is conserved over longer runs
  • something controllable!

It's possible there are mistakes but the behavior looks at least roughly right to me so I thought I'd post it anyway.

Cart #fbutuhiku-0 | 2021-12-17 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA



[Please log in to post a comment]