-Simple- 3D flocking using Javascript?

bigkahuna 101 Oct 08, 2006 at 02:04

I’m using a game engine that uses Javascript as it’s programming/scripting language and I’d like to create a very simple 3D flocking (boids) script to move 3D objects within a given area. I’ve searched the net and read a bunch of articles, and probably because I’m not much of a programmer, most of it is over my head.

Does anyone know of a super simple sample or tutorial that might get me started?

Many thanks in advance!

3 Replies

Please log in or register to post a reply.

monjardin 102 Oct 09, 2006 at 01:52

Have you already read Craig Reynold’s website?

bigkahuna 101 Oct 09, 2006 at 01:59

Yes, thank you, I have. I understand the general principles involved, but not the code as I don’t know any C. In fact the full extent of my programming is limited to some Javascript and a little HTML, PHP and Python. The engine I’m using (Unity) uses Javascript, so I’m hoping to find something that will help me put together something in that.

GroundKeeper 101 Oct 10, 2006 at 11:52

The general idea is linear algebra. Move you boids towards the center of mass. This can be done by using vector operations which is very affordable in simulation. If the linear algebra is the problem try reading up on it before. Other than that I would recommend to start looking at biods from the mathematical point of view first to not become confused with the indexes of vectors and stuff like that. If you understand the general mathematical principal the implementation is no problem.