Index: /orxonox/branches/physics/src/subprojects/particles/framework.cc
===================================================================
--- /orxonox/branches/physics/src/subprojects/particles/framework.cc	(revision 4305)
+++ /orxonox/branches/physics/src/subprojects/particles/framework.cc	(revision 4306)
@@ -102,91 +102,49 @@
       switch (event.type) {
       case SDL_MOUSEMOTION:
-	PRINTF(4)("Mouse motion about %d,%d Pixels to (%d,%d).\n", 
-		  event.motion.xrel, event.motion.yrel,
-		  event.motion.x, event.motion.y);
-	// TRACKBALL
-	if (mouse1Down)
+	{
+	  Vector view = camera->getTarget()->getAbsCoor() - camera->getAbsCoor();
+	  Vector up = Vector(0, 1, 0);
+	  up = camera->getAbsDir().apply(up);
+	  Vector h = up.cross(view);
+	  Vector v = h.cross(view);
+	  h.normalize();
+	  v.normalize();
+
+	  if (mouseDown[1])
+	    camera->setRelCoor(camera->getRelCoor()+ h * event.motion.xrel *.05 - v * event.motion.yrel * .05);
+	  if (mouseDown[3])
+	    camera->getTarget()->setRelCoor(camera->getTarget()->getRelCoor()+ h * event.motion.xrel *.05 - v * event.motion.yrel * .05);
+	    
+	}
+	break;
+      case SDL_MOUSEBUTTONDOWN:
+	switch (event.button.button)
 	  {
-	    /*
-	      int mX = event.button.x;
-	      int mY = event.button.y;
-	      int wH = GraphicsEngine::getInstance()->getResolutionY();
-	      int wW = GraphicsEngine::getInstance()->getResolutionX();
-	      Vector tmpV (mX, mY, sqrt ( (float) abs(wH * wH/4 - (wW/2-mX) * (wW/2-mX) - (wH/2-mY) * (wH/2-mY)) ));
-	      //	    PRINTF(0)("tmpV: %f, %f, %f\n", tmpV.x, tmpV.y, tmpV.z);
-	      p2 = tmpV-M;
-	      p2.y = -p2.y;
-	      rotAxis = p1.cross(p2);
-	      //  PRINTF(0)("rotAxis: %f, %f, %f\n", rotAxis.x, rotAxis.y, rotAxis.z);
-	      
-	      // in case that there is no rotation-axis defined
-	      if (rotAxis.x != 0 || rotAxis.y != 0 || rotAxis.z != 0)
-	      {
-	      rotAxis.normalize();
-	      //		PRINTF(0)("rotAxis: %f, %f, %f\n", rotAxis.x, rotAxis.y, rotAxis.z, rotAngle);
-	      
-	      rotAngle = angleRad (p1, p2);
-	      rotQ = Quaternion (rotAngle, rotAxis);
-	      rotQ = rotQ * rotQlast;
-	      rotQ.matrix (matQ);
-	      //	dir = rotQ.apply(dir);
-	      //      dir.normalize();
-	      //	PRINTF(0)("rotAxis: %f, %f, %f, %f\n", dir.x, dir.y, dir.z, rotAngle);
-	      }
-	      rotQlast = rotQ;
-	      p1 = p2;
-	    */
-	    
-
+	  case 4:
+	    PRINTF(4)("MouseWheel up\n");
+	    //zoomTo *= .5;
+	    break;
+	  case 5:
+	    PRINTF(4)("MouseWheel down\n");
+	    //zoomTo *= 2.0;
+	    break;
+	  case 1:
+	  case 2:
+	  case 3:
+	    mouseDown[event.button.button] = true;
+	    break;
 	  }
-	break;
-      case SDL_MOUSEBUTTONDOWN:
-	if (event.button.button == 4)
+	    
+	break;
+      case SDL_MOUSEBUTTONUP:
+	switch (event.button.button)
 	  {
-	    PRINTF(4)("MouseWheel up\n");
-	    //      zoomTo *= .5;
+	  case 1:
+	  case 2:
+	  case 3:
+	    mouseDown[event.button.button] = false;
+	    break;
 	  }
-	else if (event.button.button == 5)
-	  {
-	    PRINTF(4)("MouseWheel down\n");
-	    //	    zoomTo *= 2.0;
-	  }
-	else if (event.button.button == 1)
-	  {
-	    mouse1Down = true;
-	    movement[0] = event.button.x;
-	    movement[1] = event.button.y;
-	    movement[2] = 0;
-	    movement[3] = 0;
-	    printf("test %d %d\n", movement[0], movement[1]);
-	    /*
-	      int mX = event.button.x;
-	      int mY = event.button.y;
-	      int wH = GraphicsEngine::getInstance()->getResolutionY();
-	      int wW = GraphicsEngine::getInstance()->getResolutionX();
-	      Vector tmpV (mX, mY, sqrt ( (float) abs(wH * wH/4 - (wW/2-mX) * (wW/2-mX) - (wH/2-mY) * (wH/2-mY)) ));
-	      p1 = tmpV-M;
-	      p1.y = -p1.y;
-	    */
-	  }
-	else
-	  {
-	    PRINTF(0)("MouseButton %d pressed at (%d,%d).\n",
-		   event.button.button, event.button.x, event.button.y);
-	  }
-	    
-	break;
-      case SDL_MOUSEBUTTONUP:
-	if (event.button.button == 4);
-	else if (event.button.button == 5);
-	else if (event.button.button == 1)
-	  mouse1Down =false;
-	else 
-	    {
-	      PRINTF(4)("MouseButton %d released at (%d,%d).\n",
-			event.button.button, event.button.x, event.button.y);
-	    }
-	break;
-
+	break;
       case SDL_VIDEORESIZE:
 	GraphicsEngine::getInstance()->resolutionChanged(&event.resize);
@@ -247,5 +205,7 @@
   // Hide the mouse cursor
   SDL_ShowCursor(2);
-  mouse1Down = false;
+
+  for (int i = 0; i <MOUSE_BUTTON_COUNT; i++)
+    mouseDown[i] = false;
 
   ResourceManager::getInstance()->setDataDir(DATA_DIRECTORY);
Index: /orxonox/branches/physics/src/subprojects/particles/framework.h
===================================================================
--- /orxonox/branches/physics/src/subprojects/particles/framework.h	(revision 4305)
+++ /orxonox/branches/physics/src/subprojects/particles/framework.h	(revision 4306)
@@ -7,4 +7,5 @@
 
 #define DATA_DIRECTORY "~/svn/data/"
+#define MOUSE_BUTTON_COUNT 8
 
 class Camera;
@@ -20,6 +21,5 @@
     
   Uint8* keys; // This variable will be used in the keyboard routine
-  bool mouse1Down;
-  bool mouse2Down;
+  bool mouseDown[MOUSE_BUTTON_COUNT];
 
  public:
