Index: code/branches/camera/bin/ogre.cfg-init
===================================================================
--- code/branches/camera/bin/ogre.cfg-init	(revision 1286)
+++ code/branches/camera/bin/ogre.cfg-init	(revision 1287)
@@ -4,4 +4,4 @@
 FSAA=0
 Full Screen=No
-RTT Preferred Mode=PBuffer
+RTT Preferred Mode=FBO
 Video Mode=1024 x 768
Index: code/branches/camera/src/orxonox/objects/Camera.cc
===================================================================
--- code/branches/camera/src/orxonox/objects/Camera.cc	(revision 1286)
+++ code/branches/camera/src/orxonox/objects/Camera.cc	(revision 1287)
@@ -23,5 +23,5 @@
  *      Fabian 'x3n' Landau
  *   Co-authors:
- *      ...
+ *      Benjamin Knecht
  *
  */
@@ -29,4 +29,5 @@
 #include "OrxonoxStableHeaders.h"
 #include "Camera.h"
+#include "CameraHandler.h"
 
 #include <string>
@@ -47,65 +48,19 @@
 namespace orxonox
 {
-  //CreateFactory(Camera);
 
   Camera::Camera(Ogre::SceneNode* node)
   {
-    //RegisterObject(Camera);
     this->bHasFocus_ = false;
+    this->cameraNode_ = GraphicsEngine::getSingleton().getSceneManager()->getRootSceneNode()->createChildSceneNode(node->getName() + "Camera");
     if( node != NULL )
-      this->setCameraNode(node);
-
+      this->setPositionNode(node);
   }
 
   Camera::~Camera()
   {
+    CameraHandler::getInstance()->releaseFocus(this);
   }
 
-  /*void Camera::loadParams(TiXmlElement* xmlElem)
-  {
-    Ogre::SceneManager* mgr = GraphicsEngine::getSingleton().getSceneManager();
-
-    if (xmlElem->Attribute("name") && xmlElem->Attribute("pos") && xmlElem->Attribute("lookat") && xmlElem->Attribute("node"))
-    {
-      //    <Camera name="Camera" pos="0,0,-250" lookat="0,0,0" />
-
-      std::string name = xmlElem->Attribute("name");
-      std::string pos = xmlElem->Attribute("pos");
-      std::string lookat = xmlElem->Attribute("lookat");
-
-      this->cam_ = mgr->createCamera(name);
-
-      float x, y, z;
-      SubString posVec(xmlElem->Attribute("pos"), ',');
-      convertValue<std::string, float>(&x, posVec[0]);
-      convertValue<std::string, float>(&y, posVec[1]);
-      convertValue<std::string, float>(&z, posVec[2]);
-
-      setPosition(Vector3(x,y,z));
-
-      //std::string target = xmlElem->Attribute("lookat");
-      posVec.split(xmlElem->Attribute("lookat"), ',');
-      convertValue<std::string, float>(&x, posVec[0]);
-      convertValue<std::string, float>(&y, posVec[1]);
-      convertValue<std::string, float>(&z, posVec[2]);
-
-      cam_->lookAt(Vector3(x,y,z));
-
-      /*std::string node = xmlElem->Attribute("node");
-
-      Ogre::SceneNode* sceneNode = (Ogre::SceneNode*)mgr->getRootSceneNode()->createChildSceneNode(node); //getChild(node);
-      sceneNode->attachObject((Ogre::MovableObject*)cam_);
-      */
-
-      // FIXME: unused var
-      //Ogre::Viewport* vp =
-      //GraphicsEngine::getSingleton().getRenderWindow()->addViewport(cam_);
-    /*
-
-      COUT(4) << "Loader: Created camera "<< name  << std::endl << std::endl;
-    }
-  }*/
-
-  void Camera::setCameraNode(Ogre::SceneNode* node)
+  void Camera::setPositionNode(Ogre::SceneNode* node)
   {
     this->positionNode_ = node;
@@ -118,4 +73,15 @@
   }
 
+  void Camera::tick(float dt)
+  {
+    if(this->positionNode_ != NULL) {
+      // this stuff here may need some adjustments
+      Vector3 offset = this->positionNode_->getWorldPosition() - this->cameraNode_->getPosition();
+      this->cameraNode_->translate(15*dt*offset);
+
+      this->cameraNode_->setOrientation(Quaternion::Slerp(0.7, this->positionNode_->getWorldOrientation(), this->cameraNode_->getWorldOrientation(), false));
+    }
+  }
+
   /**
     don't move anything before here! here the Ogre camera is set to values of this camera
@@ -124,10 +90,9 @@
   void Camera::update()
   {
-    COUT(0) << "p " << this->positionNode_->getPosition() << std::endl;
-    COUT(0) << "t " << this->targetNode_->getPosition() << std::endl;
     if(this->positionNode_ != NULL)
-      //this->cam_->setPosition(this->positionNode_->getPosition());
-    if(this->targetNode_ != NULL)
-      this->cam_->lookAt(this->targetNode_->getPosition());
+    {
+      this->cameraNode_->setPosition(this->positionNode_->getWorldPosition());
+      this->cameraNode_->setOrientation(this->positionNode_->getWorldOrientation());
+    }
   }
 
@@ -138,6 +103,6 @@
   void Camera::removeFocus()
   {
-    this->positionNode_->detachObject(cam_);
     this->bHasFocus_ = false;
+    this->cameraNode_->detachObject(this->cam_);
   }
 
@@ -146,5 +111,6 @@
     this->bHasFocus_ = true;
     this->cam_ = ogreCam;
-    this->positionNode_->attachObject(cam_);
+    this->cam_->setOrientation(this->cameraNode_->getWorldOrientation());
+    this->cameraNode_->attachObject(this->cam_);
   }
 }
Index: code/branches/camera/src/orxonox/objects/Camera.h
===================================================================
--- code/branches/camera/src/orxonox/objects/Camera.h	(revision 1286)
+++ code/branches/camera/src/orxonox/objects/Camera.h	(revision 1287)
@@ -23,5 +23,5 @@
  *      Fabian 'x3n' Landau
  *   Co-authors:
- *      ...
+ *      Benjamin Knecht
  *
  */
@@ -45,11 +45,10 @@
         virtual ~Camera();
 
-        //inline void setPosition(Ogre::Vector3 pos) { position_->setPosition(pos); cam_->setPosition(pos); }
-        void setCameraNode(Ogre::SceneNode* node);
+        void setPositionNode(Ogre::SceneNode* node);
         inline Ogre::SceneNode* getCameraNode() { return this->positionNode_; }
         // maybe also BaseObject
         void setTargetNode(Ogre::SceneNode* obj);
 
-
+        void tick(float dt);
         void update();
         inline bool hasFocus() { return this->bHasFocus_; }
@@ -62,4 +61,6 @@
         Ogre::SceneNode* targetNode_;
         Ogre::SceneNode* positionNode_;
+        Ogre::SceneNode* cameraNode_;
+        Ogre::Vector3 oldPos;
         Ogre::Camera* cam_;
         bool bHasFocus_;
Index: code/branches/camera/src/orxonox/objects/CameraHandler.cc
===================================================================
--- code/branches/camera/src/orxonox/objects/CameraHandler.cc	(revision 1286)
+++ code/branches/camera/src/orxonox/objects/CameraHandler.cc	(revision 1287)
@@ -73,5 +73,5 @@
     focusList_.remove(cam);
     // set new focus if necessary
-    if(!(focusList_.back()->hasFocus()))
+    if(focusList_.size() > 0 && !(focusList_.back()->hasFocus()))
       focusList_.back()->setFocus(this->cam_);
   }
Index: code/branches/camera/src/orxonox/objects/SpaceShip.cc
===================================================================
--- code/branches/camera/src/orxonox/objects/SpaceShip.cc	(revision 1286)
+++ code/branches/camera/src/orxonox/objects/SpaceShip.cc	(revision 1287)
@@ -79,4 +79,5 @@
 
         this->camNode_ = 0;
+        this->cam_ = NULL;
 
         this->tt_ = 0;
@@ -148,4 +149,6 @@
         if (this->tt_)
             delete this->tt_;
+        if (this->cam_)
+          delete this->cam_;
     }
 
@@ -284,5 +287,10 @@
     {
         this->camNode_ = this->getNode()->createChildSceneNode("CamNode");
-        camNode_->setPosition(Vector3(-50,0,10));
+        camNode_->setPosition(Vector3(-30,0,10));
+        Quaternion q1 = Quaternion(Radian(Degree(90)),Vector3(0,-1,0));
+        Quaternion q2 = Quaternion(Radian(Degree(90)),Vector3(0,0,-1));
+        camNode_->setOrientation(q1*q2);
+        //this->camNode_->showBoundingBox(true);
+
 /*
 //        node->setInheritOrientation(false);
@@ -292,5 +300,5 @@
 */
         cam_ = new Camera(this->camNode_);
-        cam_->setTargetNode(this->getNode());
+        cam_->setTargetNode(this->chFarNode_);
         CameraHandler::getInstance()->requestFocus(cam_);
 //        cam->setPosition(Vector3(0,-350,0));
@@ -427,5 +435,11 @@
 
     void SpaceShip::tick(float dt)
-    {
+    {/*
+      if (this->cam_)
+        this->cam_->update();
+      */
+      if (this->cam_)
+        this->cam_->tick(dt);
+
       if (InputManager::getSingleton().getMouse()->getEventCallback() != this)
         {
