Index: /trunk/src/Makefile.am
===================================================================
--- /trunk/src/Makefile.am	(revision 6425)
+++ /trunk/src/Makefile.am	(revision 6426)
@@ -76,4 +76,5 @@
                   world_entities/weapons/ground_turret.cc \
                   world_entities/weapons/aiming_turret.cc \
+                  world_entities/weapons/targeting_turret.cc \
                   world_entities/weapons/cannon.cc \
                   world_entities/weapons/test_bullet.cc \
@@ -130,4 +131,5 @@
                  world_entities/weapons/turret.h \
                  world_entities/weapons/aiming_turret.h \
+                 world_entities/weapons/targeting_turret.h \
                  world_entities/weapons/test_bullet.h \
                  world_entities/weapons/rocket.h \
Index: /trunk/src/defs/class_id.h
===================================================================
--- /trunk/src/defs/class_id.h	(revision 6425)
+++ /trunk/src/defs/class_id.h	(revision 6426)
@@ -179,4 +179,5 @@
   CL_AIMING_TURRET              =    0x00000232,
   CL_CANNON                     =    0x00000233,
+  CL_TARGETING_TURRET           =    0x00000234,
 
   CL_TEST_BULLET                =    0x00000240,
Index: /trunk/src/orxonox.cc
===================================================================
--- /trunk/src/orxonox.cc	(revision 6425)
+++ /trunk/src/orxonox.cc	(revision 6426)
@@ -32,5 +32,4 @@
 #include "gui.h"
 
-#include "world.h"
 #include "parser/ini_parser/ini_parser.h"
 #include "game_loader.h"
Index: /trunk/src/world_entities/camera.cc
===================================================================
--- /trunk/src/world_entities/camera.cc	(revision 6425)
+++ /trunk/src/world_entities/camera.cc	(revision 6426)
@@ -199,5 +199,5 @@
   Vector up = this->getAbsDirV();
   Vector delay = Vector(0,0,0);
-  if( currentMode != VIEW_FRONT) delay = (this->target->getAbsDirX() * this->target->getSpeed())/30;
+  if( currentMode != VIEW_FRONT) delay = (this->target->getVelocity())/25;
 
   // Setting the Camera Eye, lookAt and up Vectors
Index: /trunk/src/world_entities/space_ships/helicopter.cc
===================================================================
--- /trunk/src/world_entities/space_ships/helicopter.cc	(revision 6425)
+++ /trunk/src/world_entities/space_ships/helicopter.cc	(revision 6426)
@@ -27,4 +27,5 @@
 #include "key_mapper.h"
 #include "event_handler.h"
+#include "state.h"
 
 #include "graphics_engine.h"
@@ -117,4 +118,6 @@
   xMouse = yMouse = 0;
   mouseSensitivity = 0.001;
+  rotorspeed = 1;
+  tailrotorspeed = 0;
 
   cycle = 0.0;
@@ -137,4 +140,5 @@
   registerEvent(SDLK_q);
   registerEvent(SDLK_e);
+  registerEvent(SDLK_c);
   registerEvent(KeyMapper::PEV_FIRE1);
   registerEvent(KeyMapper::PEV_NEXT_WEAPON);
@@ -172,4 +176,9 @@
 //   this->getWeaponManager()->setSlotPosition(9, Vector(-2.5, -0.3, 2.0));
 //   this->getWeaponManager()->setSlotDirection(9, Quaternion(+M_PI, Vector(1,0,0)));:
+     
+  this->getWeaponManager()->getFixedTarget()->setParent(this);
+  this->getWeaponManager()->getFixedTarget()->setRelCoor(100000,0,0);
+
+  dynamic_cast<Element2D*>(this->getWeaponManager()->getFixedTarget())->setVisibility( false);
 
 }
@@ -190,4 +199,5 @@
 {
   dynamic_cast<Element2D*>(this->getWeaponManager()->getFixedTarget())->setVisibility( true);
+  this->attachCamera();
 
 
@@ -197,5 +207,5 @@
 {
   dynamic_cast<Element2D*>(this->getWeaponManager()->getFixedTarget())->setVisibility( false);
-
+  this->detachCamera();
 
 }
@@ -257,13 +267,25 @@
 */
 void Helicopter::tick (float time)
-{
+{ 
+  tailrotorspeed += xMouse/20;
+  if (tailrotorspeed >= 0.07) tailrotorspeed = 0.07;
+  else if (tailrotorspeed <= -0.07) tailrotorspeed = -0.07;
+  
+  if (tailrotorspeed > 0.0008) tailrotorspeed -= 0.001;
+  else if (tailrotorspeed < -0.0008) tailrotorspeed += 0.001;
+  if (tailrotorspeed <= 0.001 && tailrotorspeed >= -0.001) tailrotorspeed = 0;
+  
   // spaceship controlled movement
   this->calculateVelocity(time);
 
-  Vector move = (velocity)*time;
+  Vector move = (velocity);
 
   // this is the air friction (necessary for a smooth control)
   if(velocity.len() != 0) velocity -= velocity*0.1;
 
+  //physics: Gravity
+  this->shiftCoor(Vector(0,-1,0));
+  
+  this->shiftCoor(getAbsDirY()*rotorspeed);
 
   //hoover effect
@@ -278,4 +300,5 @@
 
   this->shiftCoor (move);
+  this->shiftDir(Quaternion(-M_PI/4*tailrotorspeed, Vector(0,1,0)));
 
   this->getWeaponManager()->tick(time);
@@ -299,15 +322,11 @@
    {
      //this->shiftCoor(this->getAbsDirX());
-
-     accel += Vector(this->getAbsDirX().x,0,this->getAbsDirX().z).getNormalized()*2;
-     if((this->getAbsDirX()).y > -.2)
-     {
-       rot += Vector (0,0,1);
-       rotVal -= time/5;
-     }
+     //accel -= this->getAbsDirY();
+     rot += Vector (0,0,1);
+     rotVal -= time/5;
    }
    else
    {
-       if(this->getAbsDirX().y < -.02) this->shiftDir(Quaternion(time/5, Vector(0,0,1)));
+       if(this->getAbsDirX().y < -.02) this->shiftDir(Quaternion(time/8, Vector(0,0,1)));
    }
 
@@ -315,14 +334,11 @@
    {
      //this->shiftCoor((this->getAbsDirX())*-1);
-     accel -= Vector(this->getAbsDirX().x,0,this->getAbsDirX().z).getNormalized()*2;
-     if((this->getAbsDirX()).y < .2)
-     {
-       rot += Vector (0,0,1);
-       rotVal += time/5;
-     }
+     //accel -= this->getAbsDirY();
+     rot += Vector (0,0,1);
+     rotVal += time/5;
    }
    else
    {
-         if(this->getAbsDirZ().y > 0.02) this->shiftDir(Quaternion(-time/5, Vector(0,0,1)));
+         if(this->getAbsDirX().y > 0.02) this->shiftDir(Quaternion(-time/8, Vector(0,0,1)));
    }
 
@@ -330,11 +346,8 @@
   {
     //this->shiftDir(Quaternion(time, Vector(0,1,0)));
-    accel -= Vector(this->getAbsDirZ().x,0,this->getAbsDirZ().z).getNormalized()*2;
+    //accel -= this->getAbsDirY();
     //velocityDir.normalize();
-    if((this->getAbsDirZ()).y < .2)
-    {
-      rot +=Vector(1,0,0);
-      rotVal -= time/5;
-    }
+    rot += Vector(1,0,0);
+    rotVal -= time/5;
   }
   else
@@ -346,12 +359,8 @@
   {
     //this->shiftDir(Quaternion(-time, Vector(0,1,0)));
-
-    accel += Vector(this->getAbsDirZ().x,0,this->getAbsDirZ().z).getNormalized()*2;
+    accel += this->getAbsDirY();
     //velocityDir.normalize();
-    if((this->getAbsDirZ()).y > -.2)
-    {
-      rot += Vector(1,0,0);
-      rotVal += time/5;
-    }
+    rot += Vector(1,0,0);
+    rotVal += time/5;
   }
   else
@@ -381,20 +390,31 @@
     //this->shiftDir(Quaternion(time, Vector(0,0,1)));
 
-    accel += (this->getAbsDirY())*2;
+    rotorspeed += 0.05;
+    if (rotorspeed >= 2) rotorspeed = 2;
     //velocityDir.normalize();
     //rot += Vector(0,0,1);
     //rotVal += .4;
   }
+  else
+  {
+    if(rotorspeed >= 1.05) rotorspeed -= 0.05;
+  }
+  
   if (this->bDescend )
   {
     //this->shiftDir(Quaternion(-time, Vector(0,0,1)));
 
-    accel -= (this->getAbsDirY())*2;
+    rotorspeed -= 0.05;
+    if (rotorspeed <= 0) rotorspeed = 0;
     //velocityDir.normalize();
     //rot += Vector(0,0,1);
     //rotVal -= .4;
   }
-
-  velocity += accel;
+  else
+  {
+    if(rotorspeed <= 0.05) rotorspeed += 0.05;
+  }
+
+  //velocity += accel;
   rot.normalize();
   this->shiftDir(Quaternion(rotVal, rot));
@@ -448,8 +468,8 @@
   else if( event.type == EV_MOUSE_MOTION)
   {
-    this->xMouse = event.xRel;
-    this->yMouse = event.yRel;
-    if(((this->getAbsDirX().y) <= .2 && yMouse > 0) || ((this->getAbsDirX().y) >= -.2 && yMouse < 0)) yMouse = 0;
-    this->shiftDir(Quaternion(-M_PI/4*xMouse*mouseSensitivity, Vector(0,1,0))*Quaternion(-M_PI/4*yMouse*mouseSensitivity, Vector(0,0,1)));
+    this->xMouse = event.xRel*mouseSensitivity;
+    this->yMouse = event.yRel*mouseSensitivity;
+    
+    //this->shiftDir(Quaternion(-M_PI/4*xMouse*mouseSensitivity, Vector(0,1,0))*Quaternion(-M_PI/4*yMouse*mouseSensitivity, Vector(0,0,1)));
   }
 }
Index: /trunk/src/world_entities/space_ships/helicopter.h
===================================================================
--- /trunk/src/world_entities/space_ships/helicopter.h	(revision 6425)
+++ /trunk/src/world_entities/space_ships/helicopter.h	(revision 6426)
@@ -67,4 +67,6 @@
     float                 travelSpeed;        //!< the current speed of the player (to make soft movement)
     float                 acceleration;       //!< the acceleration of the player.
+    float                 rotorspeed;         //!< the speed of the rotor.
+    float                 tailrotorspeed;     //!< the relativ speed ot the tail rotor
 
     float                 airViscosity;
Index: /trunk/src/world_entities/space_ships/space_ship.cc
===================================================================
--- /trunk/src/world_entities/space_ships/space_ship.cc	(revision 6425)
+++ /trunk/src/world_entities/space_ships/space_ship.cc	(revision 6426)
@@ -123,5 +123,5 @@
   PRINTF(4)("SPACESHIP INIT\n");
 
-    EventHandler::getInstance()->grabEvents(true);
+  EventHandler::getInstance()->grabEvents(true);
 
   bUp = bDown = bLeft = bRight = bAscend = bDescend = bRollL = bRollR = false;
@@ -315,5 +315,12 @@
 
   //readjust
- // if (this->getAbsDirZ().y > 0.1) this->shiftDir(Quaternion(time*0.3, Vector(1,0,0)));
+  
+  /*
+    In the game "Yager" the spaceship gets readjusted when the player moves the mouse.
+    I (bknecht) go and check it out how they do it, we could probably use this also in Orxonox.
+  */
+  //if (xMouse != 0 && yMouse != 0) 
+  
+  //if (this->getAbsDirZ().y > 0.1) this->shiftDir(Quaternion(time*0.3, Vector(1,0,0)));
   //else if (this->getAbsDirZ().y < -0.1) this->shiftDir(Quaternion(-time*0.3, Vector(1,0,0)));
 
@@ -505,5 +512,6 @@
     //if (this->getWeaponManager()->hasFreeSlot(3))
     {
-      turret = new AimingTurret();
+      turret = dynamic_cast<Weapon*>(Factory::fabricate(CL_TARGETING_TURRET));
+      if (turret != NULL)
       this->getWeaponManager()->addWeapon(turret, 3);
 
Index: /trunk/src/world_entities/space_ships/space_ship.h
===================================================================
--- /trunk/src/world_entities/space_ships/space_ship.h	(revision 6425)
+++ /trunk/src/world_entities/space_ships/space_ship.h	(revision 6426)
@@ -73,5 +73,5 @@
     Vector                velocity;           //!< the velocity of the player.
     Quaternion            mouseDir;           //!< the direction where the player wants to fly
-    Quaternion rotQuat;
+    Quaternion            rotQuat;
     float                 travelSpeed;        //!< the current speed of the player (to make soft movement)
     float                 acceleration;       //!< the acceleration of the player.
Index: /trunk/src/world_entities/weapons/aiming_turret.cc
===================================================================
--- /trunk/src/world_entities/weapons/aiming_turret.cc	(revision 6425)
+++ /trunk/src/world_entities/weapons/aiming_turret.cc	(revision 6426)
@@ -90,5 +90,5 @@
 
   this->setCapability(WTYPE_ALLDIRS | WTYPE_TURRET);
-  this->setProjectileType(CL_GUIDED_MISSILE);
+  this->setProjectileType(CL_ROCKET);
 
 
@@ -142,5 +142,4 @@
             /*target->getAbsCoor() - this->getAbsCoor()*/)*.5);//this->getVelocity());
 
-  pj->setTarget(this->target->getParent());
   pj->setParent(PNode::getNullParent());
   pj->setAbsCoor(this->getEmissionPoint());
Index: /trunk/src/world_entities/weapons/guided_missile.cc
===================================================================
--- /trunk/src/world_entities/weapons/guided_missile.cc	(revision 6425)
+++ /trunk/src/world_entities/weapons/guided_missile.cc	(revision 6426)
@@ -44,5 +44,5 @@
   this->energyMax = 10;
   this->lifeSpan = 10.0;
-  this->agility = 4;
+  this->agility = 500;
   this->maxVelocity = 75;
 
@@ -156,5 +156,7 @@
      correctionVector = (( ( diffVector *  (speed * speed/( velocity.dot(diffVector ) ) )) - velocity).getNormalized()) * agility;
 
-      if(velocity.dot(diffVector) > 0)
+      if( (diffVector *  (speed * speed/( velocity.dot(diffVector ) ) ) -velocity).len() < agility )
+       velocity = ((diffVector *  (speed * speed/( velocity.dot(diffVector ) ) )).getNormalized())*agility;
+      else if(velocity.dot(diffVector) > 0)
         velocity += correctionVector;
       else if (velocity.dot(diffVector) < 0)
Index: /trunk/src/world_entities/weapons/targeting_turret.cc
===================================================================
--- /trunk/src/world_entities/weapons/targeting_turret.cc	(revision 6426)
+++ /trunk/src/world_entities/weapons/targeting_turret.cc	(revision 6426)
@@ -0,0 +1,162 @@
+/*
+   orxonox - the future of 3D-vertical-scrollers
+
+   Copyright (C) 2004 orx
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+   ### File Specific
+   main-programmer: Benjamin Grauer
+   co-programmer:
+*/
+#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_WEAPON
+
+#include "targeting_turret.h"
+
+#include "weapon_manager.h"
+#include "aim.h"
+#include "projectile.h"
+
+#include "model.h"
+
+#include "animation3d.h"
+
+#include "factory.h"
+
+CREATE_FACTORY(TargetingTurret, CL_TARGETING_TURRET);
+
+using namespace std;
+
+
+/**
+ *  standard constructor
+
+   creates a new weapon
+*/
+TargetingTurret::TargetingTurret ()
+  : Weapon()
+{
+  this->init();
+
+}
+
+
+TargetingTurret::TargetingTurret(const TiXmlElement* root)
+{
+  this->init();
+  this->loadParams(root);
+}
+
+/**
+ *  standard deconstructor
+*/
+TargetingTurret::~TargetingTurret ()
+{
+  // model will be deleted from WorldEntity-destructor
+//  delete this->target;
+}
+
+void TargetingTurret::init()
+{
+  this->setClassID(CL_TARGETING_TURRET, "TargetingTurret");
+
+  Animation3D* animation1 = this->getAnimation(WS_ACTIVATING, this);
+  Animation3D* animation2 = this->getAnimation(WS_DEACTIVATING, this);
+
+  animation1->addKeyFrame(Vector(0, -.5, 0), Quaternion(), 0.3, ANIM_LINEAR, ANIM_CONSTANT);
+  animation1->addKeyFrame(Vector(0, 0, 0), Quaternion(), 0.3, ANIM_LINEAR, ANIM_CONSTANT);
+  animation2->addKeyFrame(Vector(0, 0, 0), Quaternion(), 0.3, ANIM_LINEAR, ANIM_CONSTANT);
+  animation2->addKeyFrame(Vector(0, -.5, 0), Quaternion(), 0.3, ANIM_LINEAR, ANIM_CONSTANT);
+
+  animation1->setInfinity(ANIM_INF_CONSTANT);
+  animation2->setInfinity(ANIM_INF_CONSTANT);
+
+  this->setStateDuration(WS_SHOOTING, .1);
+  this->setStateDuration(WS_RELOADING, .1);
+  this->setStateDuration(WS_ACTIVATING, .4);
+  this->setStateDuration(WS_DEACTIVATING, .4);
+
+  this->setMaximumEnergy(10000, 50);
+  this->increaseEnergy(100000);
+
+  this->setCapability(WTYPE_ALLDIRS | WTYPE_TURRET);
+  this->setProjectileType(CL_GUIDED_MISSILE);
+
+
+  this->setEmissionPoint(1.684, 0.472, 0);
+  //this->getProjectileFactory()->prepare(100);
+
+  this->target = new Aim(this);
+  this->target->setVisibility(false);
+
+  this->loadModel("models/guns/turret2.obj");
+
+
+  this->setActionSound(WA_SHOOT, "sound/shot1.wav");
+  this->setActionSound(WA_ACTIVATE, "sound/voices/rockets.wav");
+  this->setActionSound(WA_RELOAD, "sound/vocals/reload.wav");
+}
+
+void TargetingTurret::loadParams(const TiXmlElement* root)
+{
+  static_cast<Weapon*>(this)->loadParams(root);
+
+}
+
+void TargetingTurret::activate()
+{
+  this->target->setVisibility(true);
+}
+
+void TargetingTurret::deactivate()
+{
+  this->target->setVisibility(false);
+}
+
+void TargetingTurret::tick(float dt)
+{
+  
+  this->target->tick(dt);
+}
+
+void TargetingTurret::fire()
+{
+  Projectile* pj = this->getProjectile();
+  if (pj == NULL)
+    return;
+
+  pj->setVelocity(this->getVelocity() + /*this->getVelocity()+*/(this->getAbsDir().apply(Vector(1,0,0))*250.0 + VECTOR_RAND(13)
+            /*target->getAbsCoor() - this->getAbsCoor()*/)*.5);//this->getVelocity());
+
+  pj->setTarget(this->target->getParent());
+  pj->setParent(PNode::getNullParent());
+  pj->setAbsCoor(this->getEmissionPoint());
+  pj->setAbsDir(this->getAbsDir());
+  pj->activate();
+  this->target->searchTarget(100);
+}
+
+void TargetingTurret::destroy ()
+{}
+
+/**
+ * draws the TargetingTurret
+*/
+void TargetingTurret::draw () const
+{
+  /* draw gun body */
+  glMatrixMode(GL_MODELVIEW);
+  glPushMatrix();
+  glTranslatef (this->getAbsCoor ().x,
+                this->getAbsCoor ().y,
+                this->getAbsCoor ().z);
+  Vector tmpRot = this->getAbsDir().getSpacialAxis();
+  glRotatef (this->getAbsDir().getSpacialAxisAngle(), tmpRot.x, tmpRot.y, tmpRot.z );
+  if (this->getModel() != NULL)
+    this->getModel()->draw();
+  glPopMatrix();
+}
+
Index: /trunk/src/world_entities/weapons/targeting_turret.h
===================================================================
--- /trunk/src/world_entities/weapons/targeting_turret.h	(revision 6426)
+++ /trunk/src/world_entities/weapons/targeting_turret.h	(revision 6426)
@@ -0,0 +1,37 @@
+/*!
+ * @file aiming_turret.h
+*/
+
+
+#ifndef _TARGETING_TURRET_H
+#define _TARGETING_TURRET_H
+
+#include "weapon.h"
+
+/* FORWARD DECLARATION */
+class Aim;
+
+class TargetingTurret : public Weapon
+  {
+  public:
+    TargetingTurret ();
+    TargetingTurret(const TiXmlElement* root);
+    virtual ~TargetingTurret ();
+
+    void init();
+    void loadParams(const TiXmlElement* root);
+
+    virtual void activate();
+    virtual void deactivate();
+
+    virtual void tick(float dt);
+    virtual void fire();
+    virtual void destroy();
+
+    virtual void draw() const;
+
+  private:
+    Aim*          target;
+  };
+
+#endif /* _TARGETING_TURRET_H */
