Game Development Community

Making fish "swim

by Kyle Schriener · in Torque Game Engine Advanced · 08/26/2008 (11:54 am) · 2 replies

Basically what I am working on is an aquarium with a glass area that the player walks in and can see out, water surrounding on all sides save the floor. What I am currently trying to do is make the fish that are to be in the water emulate even the most basic fish movements but I am having some trouble making them move on the z-axis. After browsing around the only methods I have been able to discover would involve flying vehicles, mounting the 'fish' to an invisible vehicle then having that cart them around etc. or possibly messing around with jump pads, both of which -could- work but there has to be a better way.

The only other thing that I thought of was possibly just setting the fish actually on different levels within the tank and having them just move around on the xy within their own levels. This method would look pretty decent when you first glance at it but would get very repetitive and seem highly unnatural the longer you watch it.

If anyone has any ideas about this like how to make AI 'Swim' or even just move in full 3d space (xyz) rather than just the 2d (xy) that setMoveDestination(); allows I would love to hear them.

-Kyle

About the author

Recent Threads

  • Shaping Water

  • #1
    08/26/2008 (12:33 pm)
    I don't know how you would do this using the "stock" classes, but what I did was make a class FishSchool which handles everything for the fish it contains. It allocates TSShapeInstances, updates a MatrixF transform (or Point3F position/heading) for each fish, and submits render instances for each one in its preprenderimage.
    #2
    08/26/2008 (12:36 pm)
    For an excellent read on flocking behaviors and with source code included look at Programming Game AI by Example by Mat Buckland. Actually you can get the source code without the book on www.wordware.com/files/ai But the book is worth getting for many reasons.