Index: code/branches/camera/src/core/Script.h
===================================================================
--- code/branches/camera/src/core/Script.h	(revision 1109)
+++ code/branches/camera/src/core/Script.h	(revision 1201)
@@ -57,5 +57,5 @@
     public:
       inline static Script* getInstance() { if (!Script::singletonRef) Script::singletonRef = new Script(); return Script::singletonRef; } // tolua_export
-      inline ~Script() { Script::singletonRef = NULL; };
+      inline ~Script() { Script::singletonRef = NULL; }
 
     void loadFile(std::string filename, bool luaTags);
Index: code/branches/camera/src/orxonox/CMakeLists.txt
===================================================================
--- code/branches/camera/src/orxonox/CMakeLists.txt	(revision 1109)
+++ code/branches/camera/src/orxonox/CMakeLists.txt	(revision 1201)
@@ -12,4 +12,5 @@
   objects/Ambient.cc
   objects/Camera.cc
+  objects/CameraHandler.cc
   objects/Explosion.cc
 #  objects/Fighter.cc
Index: code/branches/camera/src/orxonox/objects/Camera.cc
===================================================================
--- code/branches/camera/src/orxonox/objects/Camera.cc	(revision 1109)
+++ code/branches/camera/src/orxonox/objects/Camera.cc	(revision 1201)
@@ -47,56 +47,103 @@
 namespace orxonox
 {
-    CreateFactory(Camera);
+  //CreateFactory(Camera);
 
-    Camera::Camera()
+  Camera::Camera(Ogre::SceneNode* node)
+  {
+    //RegisterObject(Camera);
+    this->bHasFocus_ = false;
+    if( node != NULL )
+      this->setCameraNode(node);
+
+  }
+
+  Camera::~Camera()
+  {
+  }
+
+  /*void Camera::loadParams(TiXmlElement* xmlElem)
+  {
+    Ogre::SceneManager* mgr = GraphicsEngine::getSingleton().getSceneManager();
+
+    if (xmlElem->Attribute("name") && xmlElem->Attribute("pos") && xmlElem->Attribute("lookat") && xmlElem->Attribute("node"))
     {
-        RegisterObject(Camera);
+      //    <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;
     }
+  }*/
 
-    Camera::~Camera()
-    {
-    }
+  void Camera::setCameraNode(Ogre::SceneNode* node)
+  {
+    this->positionNode_ = node;
+    // set camera to node values according to camera mode
+  }
 
-    void Camera::loadParams(TiXmlElement* xmlElem)
-    {
-      Ogre::SceneManager* mgr = GraphicsEngine::getSingleton().getSceneManager();
+  void Camera::setTargetNode(Ogre::SceneNode* obj)
+  {
+    this->targetNode_ = obj;
+  }
 
-      if (xmlElem->Attribute("name") && xmlElem->Attribute("pos") && xmlElem->Attribute("lookat") && xmlElem->Attribute("node"))
-      {
-        //    <Camera name="Camera" pos="0,0,-250" lookat="0,0,0" />
+  /**
+    don't move anything before here! here the Ogre camera is set to values of this camera
+    always call update after changes
+  */
+  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());
+  }
 
-        std::string name = xmlElem->Attribute("name");
-        std::string pos = xmlElem->Attribute("pos");
-        std::string lookat = xmlElem->Attribute("lookat");
+  /**
+    what to do when camera loses focus (do not request focus in this function!!)
+    this is called by the CameraHandler singleton class to notify the camera
+  */
+  void Camera::removeFocus()
+  {
+    this->bHasFocus_ = false;
+  }
 
-        Ogre::Camera *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]);
-
-        cam->setPosition(Vector3(x,y,z));
-
-        posVec = SubString(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::setFocus(Ogre::Camera* ogreCam)
+  {
+    this->bHasFocus_ = true;
+    this->cam_ = ogreCam;
+    this->positionNode_->attachObject(cam_);
+  }
 }
Index: code/branches/camera/src/orxonox/objects/Camera.h
===================================================================
--- code/branches/camera/src/orxonox/objects/Camera.h	(revision 1109)
+++ code/branches/camera/src/orxonox/objects/Camera.h	(revision 1201)
@@ -30,22 +30,38 @@
 #define _Camera_H__
 
+#include <OgrePrerequisites.h>
+#include <OgreSceneNode.h>
+#include <OgreCamera.h>
+
 #include "OrxonoxPrereqs.h"
-
-#include "core/BaseObject.h"
 
 namespace orxonox
 {
-    class _OrxonoxExport Camera : public BaseObject
+    class _OrxonoxExport Camera
     {
-        public:
-            Camera();
-            virtual ~Camera();
+      friend class CameraHandler;
+      public:
+        Camera(Ogre::SceneNode* node = NULL);
+        virtual ~Camera();
+
+        //inline void setPosition(Ogre::Vector3 pos) { position_->setPosition(pos); cam_->setPosition(pos); }
+        void setCameraNode(Ogre::SceneNode* node);
+        inline Ogre::SceneNode* getCameraNode() { return this->positionNode_; }
+        // maybe also BaseObject
+        void setTargetNode(Ogre::SceneNode* obj);
 
 
-            void loadParams(TiXmlElement* xmlElem);
+        void update();
+        inline bool hasFocus() { return this->bHasFocus_; }
 
-        private:
+      private:
+        void removeFocus();
+        void setFocus(Ogre::Camera* ogreCam);
 
-
+      private:
+        Ogre::SceneNode* targetNode_;
+        Ogre::SceneNode* positionNode_;
+        Ogre::Camera* cam_;
+        bool bHasFocus_;
     };
 }
Index: code/branches/camera/src/orxonox/objects/SpaceShip.cc
===================================================================
--- code/branches/camera/src/orxonox/objects/SpaceShip.cc	(revision 1109)
+++ code/branches/camera/src/orxonox/objects/SpaceShip.cc	(revision 1201)
@@ -23,5 +23,5 @@
  *      Fabian 'x3n' Landau
  *   Co-authors:
- *      ...
+ *      Benjamin Knecht
  *
  */
@@ -38,4 +38,5 @@
 #include <OgreSceneNode.h>
 
+#include "CameraHandler.h"
 #include "util/tinyxml/tinyxml.h"
 #include "util/Convert.h"
@@ -282,6 +283,6 @@
     void SpaceShip::setCamera(const std::string& camera)
     {
-        Ogre::Camera *cam = GraphicsEngine::getSingleton().getSceneManager()->createCamera("ShipCam");
         this->camNode_ = this->getNode()->createChildSceneNode("CamNode");
+        camNode_->setPosition(this->getNode()->getPosition() + Vector3(-50,0,10));
 /*
 //        node->setInheritOrientation(false);
@@ -290,12 +291,11 @@
         cam->roll(Degree(0));
 */
-
-        cam->setPosition(Vector3(-200,0,35));
+        cam_ = new Camera(this->camNode_);
+        cam_->setTargetNode(this->getNode());
+        CameraHandler::getInstance()->requestFocus(cam_);
 //        cam->setPosition(Vector3(0,-350,0));
-        cam->lookAt(Vector3(0,0,35));
-        cam->roll(Degree(-90));
-
-        this->camNode_->attachObject(cam);
-        GraphicsEngine::getSingleton().getRenderWindow()->addViewport(cam);
+        //cam->roll(Degree(-90));
+
+        //this->camNode_->attachObject(cam);
     }
 
Index: code/branches/camera/src/orxonox/objects/SpaceShip.h
===================================================================
--- code/branches/camera/src/orxonox/objects/SpaceShip.h	(revision 1109)
+++ code/branches/camera/src/orxonox/objects/SpaceShip.h	(revision 1201)
@@ -23,5 +23,5 @@
  *      Fabian 'x3n' Landau
  *   Co-authors:
- *      ...
+ *      Benjamin Knecht
  *
  */
@@ -35,6 +35,8 @@
 #include <OIS/OISMouse.h>
 
+#include "Camera.h"
 #include "Model.h"
 #include "../tools/BillboardSet.h"
+
 
 namespace orxonox
@@ -80,4 +82,5 @@
 
             Ogre::SceneNode* camNode_;
+            Camera* cam_;
 
             ParticleInterface* tt_;
