PostADay-Round2#2 – Cinder/C++ Boid class port

It’s weird porting something that was written into, c++ ported to AS3, back to C++. However If you’ve ever tried to find the C++ version of a boids class. They’re all too complicated for my needs, and i really like the way @soulwire ‘s version works so I started porting it into C++. Based largely on my iOS port of the same class.

https://github.com/onedayitwillmake/CinderBoid

VIDEO DEMOS

WanderSeek

BoidTrailTest from mario gonzalez on Vimeo.

Basic Usage

.cpp

Creation

 
<code>
float boidMaxSpeed = 100;
float boidMaxForce = 25;
 
// Create
_boid = new Boid( boidMaxSpeed, boidMaxForce );
_boid-&gt;setPosition( _target.x, _target.y, _target.z );
 
// Set wander properties
_boid-&gt;setWanderRadius( 75.0f );
_boid-&gt;setWanderMaxTurningSpeed( M_PI / 32 ); // 
_boid-&gt;setWanderLookAheadDistance( 300 );
 
</code>

Update



_boid->wander( 0.3f );
_boid->seek( _mousePositionXYZ, 0.8f );
_boid->update();



Gravity Swarm for ipad

GravitySwarm is an application I’m creating for the ipad.

It’s a gravity swarm simulation, you create gravitational forces with your fingers and watch how the swarm interacts.
The swarm moves via low-octave perlin noise combined with proximity attraction.

I created it using Cinder which I’ve been using a lot lately and its really tons of fun.

Gravity Swarm from mario gonzalez on Vimeo.