Aquarium Boids

William McIntyre

I initially built a skin-on-bone shark model in maya with the intention of having it swim around attacking fish. I spent way too much time trying to get the fish to swim around smoothly and accurately, so for now it's just an aquarium.

There are 15 unique textured/shaded fish meshes with 8 of each fish type being spawned in a random locality. The mesh groups mix and collide with eachother to move in and out of bigger or smaller schools and avoid obstacles.

I'm pretty happy with the accuracy of the fish movement. I'm using a full boids/flocking implementation with cohesion and collisions. The cohesion and separation calculations are tuned to work a little too hard against eachother to get that sort of fish-like twitchy effect in the video. I did a lot of vector math to get collision/wall bounce to seek reasonable paths that look natural with the boid's incoming velocities (ie. pushing the boid left when scraping object on right).

One of the hardest things to figure out was getting the boids to have really dynamic 3d orientations following their velocities. Occasionally, abrupt velocity changes (like corners) will still flip upside-down, but they correct themselves after. I realize now I should have used quaternions, but I didn't know about them when making this project so I was doing a lot of math.

Technologies: Boids/Flocking, cohesion, spherical & cylindrical collisions, bounding/bounce, textures/directional light, a Lot of trig

References