web-particle-system

Web Particle System

This is a simple Particle System with the aim to simulate water.

GitHub Project - Download - Demo Version

Each particle is represented by a square and a line. The square is the particle itself and the line is the velocity vector i.e. shows the direction that the particle is moving and with what force.

The script targets to updated at 60fps. In each frame, the vectors of all particles are recalculated. Each particle exercises small repelling force on the nearby particles and the resulting vector is calculated after summing all interactions.

For efficient neighbor search, the space is partitioned in a grid of zones and each particle is assigned to one. Then we just have to look for particles in the adjacent zones to the particle.

Despite the resemblance of final result with actual water, it is still far away from good simulation. Other algorithms should be used.

Interaction