https://vimeo.com/87669676 (video pending conversion)
here is a gif: http://imgur.com/MvwuGLz
Using a set to store the near bodies for each body using a sensor, I then calculate the forces to make the pack hold somehow together.
I also use an arriving behavior or a simple setlinearvelocity.
Past 500 bodies the simulation starts to be slow, I did some profiling with verysleepy, apparently it comes from box2d, but I'm not expert.
I can configure many parameters, cohesion and separate factors, the radius of the sensor, etc. I tried to use a vertexarray to draw the balls, without any performance increase (I thought it would reduce the number of draw batches).
Some thanks to people on stackoverflow and other IRC channels who helped me a little with it...
here is a gif: http://imgur.com/MvwuGLz
Using a set to store the near bodies for each body using a sensor, I then calculate the forces to make the pack hold somehow together.
I also use an arriving behavior or a simple setlinearvelocity.
Past 500 bodies the simulation starts to be slow, I did some profiling with verysleepy, apparently it comes from box2d, but I'm not expert.
I can configure many parameters, cohesion and separate factors, the radius of the sensor, etc. I tried to use a vertexarray to draw the balls, without any performance increase (I thought it would reduce the number of draw batches).
Some thanks to people on stackoverflow and other IRC channels who helped me a little with it...