In the end, he got tired of writing all the coordinates for the terrain vertices, but he did get quite far.
Applying Box2D to translate from pixels into mm:
On Thursday Simon was busy with writing his own code in Java. He called it “Path Following”. The project basically involved simulating different phenomena with a physics particle (having it follow a path, fall and bounce).
The most interesting part of this challenge Simon invented for himself was applying restitution to make the particle bounce in a realistic way (Simon failed several times but eventually succeeded). “If a bound hits the physics particle I’m going to multiply the physics particle’s velocity by -0.8 (0.8 is the arbitrary restitution, so I multiply the velocity by the negative restitution)”, Simon explained.
He also planned to incorporate collision detection in this project but didn’t succeed.
Here the particle is drawing a graph (“noise without a noise function”):
Here Simon adds one more particle and is trying to create collision detection and make the particles restitute:
Debugging and using inheritance for the second particle:
Making the particle remember the graph:
Applying gravity to the physics particle:
Trying to make the physics particle bounce (apply restitution). In this video Simon doesn’t succeed.
Simon manages to control the particle’s bounce (with the mouse) but there’s still no restitution:
In the following video Simon finally won: he figured out how to apply restitution to the bouncing particle making it look like a bouncing ball. After a few bounces however, the particle collapsed (Simon solved the collapsing problem later on: in his code, the < and > should be <= and >=).
In a steering behavior variation, trying to teach a particle to follow a given path (road). Simon hoped to apply a genetic algorithm here but got stuck:
Simon built this awesome animation that looks and moves like a hammock on Sunday, a coding challenge on Daniel Shiffman’s channel. In this challenge Simon used the toxiclibs physics library to create a 3D cloth in Processing (Java). Creating a 2D cloth involved programming particles and springs, looping them to one single row and later looping them to form a grid.
After the 2D cloth was ready, Simon turned it into a 3D cloth by adding the z-axis.
He started with Daniel Shiffman intro to Matter.js, downloaded it using GitBash and then went on by following further Matter.js tutorials on Daniel Shiffman’s channel. Simon built two physics simulations with static shapes and circular bodies: one resembling a waterfall and another resembling a dangling chain. The sketches involved constraints for mouse interaction. Simon also learned how to delete off-screen bodies from the physics world, removing them from both his particle array as well as Matter.world.