Index: /branches/vs-enhencements/src/ai/swarm_gorel.cc
===================================================================
--- /branches/vs-enhencements/src/ai/swarm_gorel.cc	(revision 10654)
+++ /branches/vs-enhencements/src/ai/swarm_gorel.cc	(revision 10655)
@@ -23,5 +23,5 @@
 
 	//calculate  movement parameters..
-	float averageRadius;
+	float averageRadius = 0;
 	for (it=members.begin(); it!= members.end(); it++ ){
 		averageRadius+=it->second->getNPCRadius();
Index: /branches/vs-enhencements/src/lib/math/quaternion.h
===================================================================
--- /branches/vs-enhencements/src/lib/math/quaternion.h	(revision 10654)
+++ /branches/vs-enhencements/src/lib/math/quaternion.h	(revision 10655)
@@ -115,5 +115,5 @@
 
 
-    inline void slerpTo(const Quaternion& toQuat, float t);
+    void slerpTo(const Quaternion& toQuat, float t);
     static Quaternion quatSlerp(const Quaternion& from, const Quaternion& to, float t);
 
Index: /branches/vs-enhencements/src/lib/math/vector.h
===================================================================
--- /branches/vs-enhencements/src/lib/math/vector.h	(revision 10654)
+++ /branches/vs-enhencements/src/lib/math/vector.h	(revision 10655)
@@ -64,4 +64,6 @@
   /** @param v The vector to substract  @returns the substraction between two vectors (this - v) */
   inline Vector operator- (const sVec3D& v) const { return Vector(x - v[0], y - v[1], z - v[2]); }
+  /** @returns the substraction between (0, 0, 0) and this (null-this) */
+  inline Vector operator- () const { return Vector(-x, -y, -z); }
   /** @param v The vector to substract  @returns the substraction between two vectors (this -= v) */
   inline const Vector& operator-= (const Vector& v) { this->x -= v.x; this->y -= v.y; this->z -= v.z; return *this; };
Index: /branches/vs-enhencements/src/world_entities/npcs/actionbox_enemy.cc
===================================================================
--- /branches/vs-enhencements/src/world_entities/npcs/actionbox_enemy.cc	(revision 10654)
+++ /branches/vs-enhencements/src/world_entities/npcs/actionbox_enemy.cc	(revision 10655)
@@ -83,34 +83,29 @@
 {
   Vector targetPos = State::getPlayer()->getPlayable()->getAbsCoor();
+  Vector targetDir = targetPos - this->getAbsCoor();
   
-  Vector fw = this->getAbsDir().apply( Vector( 0, 0, -1 ) );
-  fw.normalize();
   
-  Vector dv = targetPos - this->getAbsCoor();
-  dv.normalize();
+  Quaternion cur = this->getAbsDir();
+  Quaternion rx( 5*dt, Vector( 0, 0, 1 ) );
   
-  Vector up = fw.cross( dv )*-1;
+  Quaternion tmp1 = cur * rx;
+  Quaternion tmp2 = cur * rx.inverse();
   
-  Quaternion rot(up, 10.0*dt);
-  rot.normalize();
-  Quaternion cur = this->getAbsDir();
-  Quaternion ne = rot * cur;
-  this->setAbsDir( ne );
+  if ( tmp1.apply( Vector(1, 0, 0) ).dot(targetDir) > tmp2.apply( Vector(1, 0, 0)).dot(targetDir) )
+    cur = tmp1;
+  else
+    cur = tmp2;
   
-  // 1, 0, 0
-  // 0, 1, 0
-  return;
-  Vector k = ne.apply( Vector( 1, 0, 0 ) );
-  k.normalize();
+  Quaternion ry( 5*dt, cur.inverse().apply( Vector( 0, 1, 0 ) ) );
   
-  Vector vr = k.cross( Vector( 0, 1, 0) );
+  tmp1 = cur * ry;
+  tmp2 = cur * ry.inverse();
   
-  rot = Quaternion(vr, 10.0*dt);
-  rot.normalize();
-  cur = ne;
-  ne = rot * cur;
-  ne.normalize();
- 
-  this->setAbsDir( ne );
+  if ( tmp1.apply( Vector(1, 0, 0) ).dot(targetDir) > tmp2.apply( Vector(1, 0, 0)).dot(targetDir) )
+    cur = tmp1;
+  else
+    cur = tmp2;
+  
+  this->setAbsDir( cur ); 
 }
 
@@ -130,5 +125,10 @@
   dv += mp;
   
-  Vector up = fw.cross( dv )*-1;
+  Vector spUp = this->getAbsDir().inverse().apply( this->getAbsDir().apply( Vector( 0, 1, 0 ) ) );
+  spUp.normalize();
+  spUp *= 100;
+  spUp += mp;
+  
+  Vector up = fw.cross( dv );
   up += mp;
   
@@ -154,4 +154,5 @@
   glEnd();
   
+  glColor3f(0.0, 1.0, 0.0 );
   glBegin(GL_LINE_STRIP);
     glVertex3f(mp.x, mp.y, mp.z);
@@ -159,7 +160,14 @@
   glEnd();
   
+  glColor3f(0.0, 0.0, 1.0 );
   glBegin(GL_LINE_STRIP);
     glVertex3f(mp.x, mp.y, mp.z);
     glVertex3f(up.x, up.y, up.z);
+  glEnd();
+  
+  glColor3f(1.0, 1.0, 1.0 );
+  glBegin(GL_LINE_STRIP);
+    glVertex3f(mp.x, mp.y, mp.z);
+    glVertex3f(spUp.x, spUp.y, spUp.z);
   glEnd();
 
