Index: code/branches/bigships/src/orxonox/items/Engine.cc
===================================================================
--- code/branches/bigships/src/orxonox/items/Engine.cc	(revision 8136)
+++ code/branches/bigships/src/orxonox/items/Engine.cc	(revision 8426)
@@ -35,5 +35,5 @@
 #include "Scene.h"
 #include "worldentities/pawns/SpaceShip.h"
-#include "tools/Shader.h"
+#include "core/Template.h"
 
 namespace orxonox
@@ -47,4 +47,5 @@
         this->ship_ = 0;
         this->shipID_ = OBJECTID_UNKNOWN;
+		this->relativePosition_ = Vector3(0,0,0);
 
         this->boostFactor_ = 1.5;
@@ -62,6 +63,4 @@
         this->accelerationUpDown_ = 0.0;
 
-        this->boostBlur_ = 0;
-
         this->speedAdd_ = 0.0;
         this->speedMultiply_ = 1.0;
@@ -75,8 +74,8 @@
         if (this->isInitialized() && this->ship_)
         {
-            this->ship_->setEngine(0);
-
-            if (this->boostBlur_)
-                this->boostBlur_->destroy();
+            //this->ship_->setEngine(0);
+
+            //if (this->boostBlur_)
+            //    this->boostBlur_->destroy();
         }
     }
@@ -98,13 +97,11 @@
         XMLPortParam(Engine, "accelerationleftright", setAccelerationLeftRight, setAccelerationLeftRight, xmlelement, mode);
         XMLPortParam(Engine, "accelerationupdown",    setAccelerationUpDown,    setAccelerationUpDown,    xmlelement, mode);
+
+		XMLPortParam(Engine, "position", setRelativePosition, getRelativePosition, xmlelement, mode);
+		XMLPortParam(Engine, "template", setEngineTemplate, getEngineTemplate, xmlelement, mode);
     }
 
     void Engine::setConfigValues()
     {
-        SetConfigValueExternal(bEnableMotionBlur_, "GraphicsSettings", "enableMotionBlur", true)
-            .description("Enable or disable the motion blur effect when moving very fast")
-            .callback(this, &Engine::changedEnableMotionBlur);
-        SetConfigValueExternal(blurStrength_, "GraphicsSettings", "blurStrength", 3.0f)
-            .description("Defines the strength of the motion blur effect");
     }
 
@@ -202,23 +199,15 @@
         }
 
-        this->ship_->setAcceleration(this->ship_->getOrientation() * (acceleration*this->getSpeedMultiply()+Vector3(0,0,-this->getSpeedAdd())));
-
-        if (!this->ship_->getPermanentBoost())
-            this->ship_->setBoost(false);
-        this->ship_->setSteeringDirection(Vector3::ZERO);
-
-        if (this->bEnableMotionBlur_ && !this->boostBlur_ && this->ship_->hasLocalController() && this->ship_->hasHumanController())
-        {
-            this->boostBlur_ = new Shader(this->ship_->getScene()->getSceneManager());
-            this->boostBlur_->setCompositorName("Radial Blur");
-        }
-
-        if (this->boostBlur_ && this->maxSpeedFront_ != 0 && this->boostFactor_ != 1)
-        {
-            float blur = this->blurStrength_ * clamp((-velocity.z - this->maxSpeedFront_) / ((this->boostFactor_ - 1) * this->maxSpeedFront_), 0.0f, 1.0f);
-
-            this->boostBlur_->setVisible(blur > 0);
-            this->boostBlur_->setParameter(0, 0, "sampleStrength", blur);
-        }
+		// NOTE: Bullet always uses global coordinates.
+        this->ship_->addAcceleration(this->ship_->getOrientation() * (acceleration*this->getSpeedMultiply()+Vector3(0,0,-this->getSpeedAdd())), this->ship_->getOrientation() * this->relativePosition_);
+
+
+		// Hack to reset a temporary variable "direction"
+		this->ship_->oneEngineTickDone();
+		if(!this->ship_->hasEngineTicksRemaining())
+		{
+			this->ship_->setSteeringDirection(Vector3::ZERO);
+			this->ship_->resetEngineTicks();
+		}
     }
 
@@ -226,7 +215,4 @@
     {
         SUPER(Engine, changedActivity);
-
-        if (this->boostBlur_)
-            this->boostBlur_->setVisible(this->isVisible());
     }
 
@@ -238,12 +224,6 @@
         {
             this->shipID_ = ship->getObjectID();
-            if (ship->getEngine() != this)
-                ship->setEngine(this);
-
-            if (this->boostBlur_)
-            {
-                this->boostBlur_->destroy();
-                this->boostBlur_ = 0;
-            }
+            if (!ship->hasEngine(this))
+                ship->addEngine(this);
         }
     }
@@ -267,11 +247,15 @@
     }
 
-    void Engine::changedEnableMotionBlur()
-    {
-        if (!this->bEnableMotionBlur_)
-        {
-            this->boostBlur_->destroy();
-            this->boostBlur_ = 0;
-        }
-    }
+	void Engine::loadEngineTemplate()
+	{
+		if(!this->engineTemplate_.empty())
+		{
+			COUT(4)<<"Loading an engine template: "<<this->engineTemplate_<<"\n";
+			Template *temp = Template::getTemplate(this->engineTemplate_);
+			if(temp)
+			{
+				this->addTemplate(temp);
+			}
+		}
+	}
 }
