Inspiration

We believed it would be a simple task to model the dynamics of a system of n balls obeying properties of an ideal gas. However, quite a ways into development, we realized that modeling the dynamics of collisions was harder than one might expect, with recurring issues of balls being fused together, multiple balls colliding at a time, and dynamics not behaving how we expected. With some effort though, we believe we have created a suitable foundation for a more robust and powerful physical simulator.

What it does

Spaceballs is derived from Hamiltonian equations of motion which allows for the incorporation and emphasis of potential and potential functions. One can enter an arbitrary static potential function depending on position, constants, mass, and electric charge. The model is able to simulate collisions based on a coefficient of restitution, allowing for elastic and inelastic collisions. Furthermore, one can populate a space of any number of particles to observe how the interact gravitationally, and electromagnetically. Spaceballs does well on small to medium sized systems and allows for insight into how such systems involve by observing motion of bodies in that system.

How we built it

Spaceballs is completely implemented in python, using open3d for rendering, though all of the physics and dynamics was derived by hand and implemented through hefty use of numpy and matrix operations. Towards the end, we implemented a simple GUI to make the program more user friendly, which allows for applying external forces to existing bodies and for creating new bodies in the middle of simulation.

Challenges we ran into

As it turns out, physical simulation is not in fact easy. When many bodies come together simultaneously, it was difficult to derive a general way to handle it. Furthermore, due to issues that we suspect to be related to precision, energy can sometimes seem to be created out of elastic collisions. Implementing general interaction terms between particles, specifically the magnetic force, was quite difficult to generalize for any number of bodies.

Accomplishments that we're proud of

We are satisfied that we have created a decently functioning physics simulator for spherical bodies. We are proud of the fact that we were able to work out how to handle general simultaneous collisions, and are happy with the inclusion of user defined potential functions. We are also proud of the fact that we could simulate a wide variety of different forces, which makes the system quite adaptable.

What we learned

One thing we have learned is that sleep is very important. It is difficult to process the complex ideas of physics simulation when getting practically no sleep.

What's next for Spaceballs

We hope to improve Spaceballs to be a more general physics simulator, being able to handle not only balls, but other kinds of objects and collision geometry. We know Spaceballs is not intended to be used in high precision environments, but we believe it can be made into a valuable tool to observe how complex dynamical systems evolve. It allows for an easier time to develop an intuitive understanding of how such systems work.

Built With

Share this project:

Updates