Jump to content

Boids using the Unigine Component System


Recommended Posts

I implemented the agent-based flocking algorithm "Boids" in the Unigine component system for fun. See http://www.kfish.org/boids/pseudocode.html

It's an incomplete implementation, don't expect too much. But it does make for a nice organic-feeling movement pattern.

To get started with the attached code, make a new project making sure to tick the "Component System" box Unpack the .ZIP attached C++ files over the defaults. In the editor, make a bunch of ObjectMeshDynamic cubes (Create->Primitive->Cube) and scatter them around. I used 14, but you can use any number. Scale them down to 0.1. If you click-drag you can clone them or select some in the "world" tab and right-click for "clone". So long as they're called "Cuboid<something>" (hard coded, see source) they'll be animated.

image.thumb.png.305b1ad5e014ba85bb4166af1abe521c.png

 

Action shot with rule-vector debugging on.

image.thumb.png.80db026c4ccacd228cbb3b08e9a65dd4.png

 

 

cs_1.zip

Edited by angus
  • Like 5
Link to comment
×
×
  • Create New...