Beachball Physics demos

Below you find my demos for the Beachball Physics supplement, my as of 2023 brand new supplement on fundamental game physics.


The demos range, like the supplement, from the very basic to some more interesting cases. They come in a single archive with a makefile for Linux.


download


Updated 2023-09-19.


The demos are all based on my “GLUGG” package, to avoid separate files for models, and many use SimpleGUI for controls.


Chapter 2: Fundamental laws

Skärmavbild 2023-09-05 kl. 07.12.20

“Push” is a very simple demo showing how an impule affects two balls, optionally of different size. SimpleGUI is used for customising the size and impulse.


Chapter 3: Projectiles


Here we find the demos "Arrow" and "Three beachballs 1".

“Arrow” is another trivial demo with an arrow affected by gravity. Nothing strange.

“Three beachballs 1” is more interesting. Three beachballs are bouncing on the floor, and all three bounce in a seemingly reasonable way but behave totally different.


Chapter 4: Collisions


Now the demos get more interesting.

“Arrow 2” is a follow-up to “Arrow” above, but with a plastic collision with a ball (apple).

Skärmavbild 2023-09-05 kl. 08.55.13

With “Double bounce” I think I will get your attention, especially with the follow-up “Double bounce 12” later. This version does elastic collisions between two balls with configurable size and initial velocity and positions.


Chapter 5: Rotations

The demo “Kinematic rotations” adds rotations based on the collision with the walls. This is kinematic, no forces.

Skärmavbild 2023-09-05 kl. 08.48.59

“Double bounce 2” adds the same kinematic rotations, but now with the two balls from “Double bounce”, which looks a lot more realistic despite skipping over a lot of things.


Following this come two demos about physically correct rotations, or more correctly expressed, kinetic rotations:

"The plank 1” is a plank sliding freely on a surface.

“The plank 2” is fastned at an axis that it can rotate around.

“Many beachballs” is an unfinished demo with many beachballs, that are at this point not pililng up correctly, but they adapt their rotations to each other, which is what it is currently about.


Chapter 6: Friction


Here I have some rather scary demos that show why friction is more than just the physics (which is of course included in the demos).

“Sliding block” is a block given certain velocity, which makes it lose velocity from friction until it stops… but does it?

With “sliding block 2” we can also tilt the plane. I am not totally happy with this yet so I consider it preliminary.


Chapter 7: Springs


These demos are based on an old demo I have had for several years, called “Boing”. It was getting outdated, not something I could upload, and the name collides with the famous Amiga demo, so now it is “Sproing”.

This is the basic “Sproing”, a 2D array of particles connected by springs, and you can animate it with a few different options.


This was fun, so let’s expand to 3D:

This is called “Sproing 3D". It is notable that the number of particles is rather low. If you expand this further, you will want to evaluate the system on the GPU.


The same demo can be set to show a surface instead of the particles:

This looks pretty nice IMHO.


The system can be used to simulate cloth, which I do in “Sproing cloth”.


Chapter 8: Wind effects


Here I cover drag, spin and wind.

The “three beachballs” are back but now with aerodynamic drag. The demo straight up shows the different behavior with and without aerodynamic drag. No surpises there.


A more interesting case is the “mouse and elephant”, which is demonstrated by my “bowlilng balls” demos. Why bowling balls? Because we need to have the same density to match the problem.


I have not yet added any configuration on this. I should, since you will find that no matter how you vary it the elephant will still fall faster - unless you remove the aerodynamic drag.

The next demos shows the effect of spin, the “Magnus force”. The initial spin is configurable. The effect is an important reason for me to choose beachballs since the effect is just like this in real life.


Finally, we have the “wind” demo:

This is basically how confetti works. The text also describes how a falling wall works, but I have not made a demo for that yet.


Chapter 9: Sailing ships


This is a chapter that I added just for fun, I think. Well, the way forces are projected in multimple steps is interesting. It resulted in a first sailing demo, “boat 1”, were you can control the rotation of the boat and the sail.

The demo is currently a bit clunky, since this is not how you control a sail in real life, but the effect is pretty OK in my opinion.


Chapter 10: Waves


I have made a demo of Gerstner waves, but it is not ready for upload at this time.


Phew, 21 demos! I hope you will find some of them useful. At this time, 2023, they are brand new and I don’t know what you will think about them. Opinions as well as suggestions for improvements are welcome. And… of course you are welcome to hack around and make them better!

This page is maintained by Ingemar Ragnemalm.