I manage to sort the problem, but I have to admit I dont understand how it got fix...
From an old PM from
dlp, he said
Code:PVector new_dir = velocity.get();
PVector new_up = new PVector(0.0, 0.0, 1.0);
new_up.normalize();
PVector crss = velocity.cross(new_up);
float theAngle = PVector.angleBetween(new_dir, new_up);
crss.normalize();
pushMatrix();
rotate(-theAngle, crss.x, crss.y, crss.z);
popMatrix();
I remove this block from the Boid class display()
Code:PVector new_forward = velocity;
new_forward.normalize();
PVector new_up = new PVector(0.0, 1.0, 0.0);
new_up.normalize();
PVector new_side = new_up.cross(new_forward);
new_side.normalize();
new_up = new_side.cross(new_forward);
new_up.normalize();
and the applyMatrix() for the rotation, and change it to
dlp suggestion
Notice the new_up orientation change
Code:PVector new_up = new PVector(0.0, 1.0, 0.0);
to
PVector new_up = new PVector(0.0, 0.0, 1.0);
Old version
http://nardove.com/p5/misc/steering_3/
New version
http://nardove.com/p5/misc/steering_3a/
It works fine, so far I havent spot any irregularities.
Thanks to all involved
rS