Random walk?

I have a project in mind. Don’t know if this is a final project or another crazy idea that in time will morph into something more practical and doable.

A part of this system that I want to create, involves a group of objects that crashes on a terrain (later, hope to create a 3D height map), and scatter around. As a part of my decision to work on this project throughout the semester – I decided to try and create this crashing-scattering system.

I decided to make a 2D sketch that animates a top view of a grid of rectangles that free-falls to the ground. Once the grid hits this invisible ground the squares scatter around.

In this sketch, I tried to incorporate the randomness in the scattering of the squares.
The main work was to have the distribution of the scattering make sense in the matter of directionality. For the first time I had to work with p5 vectors in order to associate direction to the velocity of each square.

I got to the point that in reference to the middle of the grid, the squares are given a random vector according to the quarter their positions, meaning they are given only a direction. I still haven’t managed to give different amount of “force” according to distance from the middle.

In addition, I added some rotation to the squares and a color change according to the distance they travel until they stop.

here’s the sketch :

https://editor.p5js.org/Ayal1987/present/8gPSu8x_C

here’s the code

https://editor.p5js.org/Ayal1987/sketches/8gPSu8x_C


Leave a Reply

Your email address will not be published. Required fields are marked *