The end?
Probably not, but it sounds cool and is a Minecraft reference.
Anyway, as you can see, I (sadly along with the help of an LLM, since I’m not the best at physics (i promise I only used it to explain the physics part and fix some insanely weird bugs)) implemented the collision system.
What it took
So, to achieve this and not make my computer burn down, I used a spatial grid. The way this one worked is:
- I added 2 buffers, one for cell heads, and other for next particles
- Created a linked list using those, with the last one pointing to index -1.
- Then, using some nonsense calculations, for every particle I checked every particle in their own cell and the 8 surrounding ones. That way I didn’t have to make a literal billion if statements per second.
- Then I fiddled around with making the particles stop moving on their own, and bim bam boom, I’ve got a nice layer of particles at the bottom.
What’s next?
I probably won’t finish this during stardance, but I’ll add some mouse interactions so the simulation isn’t so stagnant, and that should probably be it.
Attachments
In the attachments you’ve got a simulation of 2,000 and 100,000 particles, and a screenshot of the final result.
Comments 2
HOW THE FUCK ARE THEY CORRUPT
too bad, i guess.
Sign in to join the conversation.