[Orxonox-commit 1764] r6482 - in code/branches/tutorial: . data/levels src/orxonox/controllers src/orxonox/pickup src/orxonox/worldentities

rgrieder at orxonox.net rgrieder at orxonox.net
Sun Mar 7 22:11:32 CET 2010


Author: rgrieder
Date: 2010-03-07 22:11:31 +0100 (Sun, 07 Mar 2010)
New Revision: 6482

Added:
   code/branches/tutorial/src/orxonox/controllers/DroneController.cc
   code/branches/tutorial/src/orxonox/controllers/DroneController.h
   code/branches/tutorial/src/orxonox/worldentities/Drone.cc
   code/branches/tutorial/src/orxonox/worldentities/Drone.h
Modified:
   code/branches/tutorial/
   code/branches/tutorial/data/levels/tutorial.oxw
   code/branches/tutorial/src/orxonox/controllers/
   code/branches/tutorial/src/orxonox/controllers/CMakeLists.txt
   code/branches/tutorial/src/orxonox/pickup/BaseItem.h
   code/branches/tutorial/src/orxonox/worldentities/
   code/branches/tutorial/src/orxonox/worldentities/CMakeLists.txt
Log:
Merged HS 2009 tutorial in new FS 2010 branch. This includes all the previous tutorials as well.


Property changes on: code/branches/tutorial
___________________________________________________________________
Modified: svn:mergeinfo
   - /code/branches/buildsystem:1874-2276,2278-2400
/code/branches/buildsystem2:2506-2658
/code/branches/buildsystem3:2662-2708
/code/branches/ceguilua:1802-1808
/code/branches/console:5941-6104
/code/branches/core3:1572-1739
/code/branches/core4:3221-3224,3227,3234-3238,3242,3244-3250,3252-3254,3256,3259-3261,3264-3265,3268-3275,3277-3278,3280,3284-3285,3287,3289-3294,3305,3309-3310
/code/branches/core5:5768-5928,6009
/code/branches/gametypes:2826-3031
/code/branches/gcc43:1580
/code/branches/gui:1635-1723,2795-2894
/code/branches/ingamemenu:6000-6023
/code/branches/input:1629-1636
/code/branches/libraries:5612-5692
/code/branches/libraries2:5703-5737
/code/branches/lodfinal:2372-2411
/code/branches/map:2801-3086,3089
/code/branches/menu:5941-6146,6148
/code/branches/miniprojects:2754-2824
/code/branches/netp2:2835-2988
/code/branches/netp3:2988-3082
/code/branches/netp6:3214-3302
/code/branches/network:2356
/code/branches/network64:2210-2355
/code/branches/objecthierarchy:1911-2085,2100,2110-2169
/code/branches/objecthierarchy2:2171-2479
/code/branches/overlay:2117-2385
/code/branches/particles:2829-3085
/code/branches/particles2:6050-6106,6109
/code/branches/pch:3113-3194
/code/branches/physics:1912-2055,2107-2439
/code/branches/physics_merge:2436-2457
/code/branches/pickups:1926-2086,2127,2827-2915
/code/branches/pickups2:2107-2497,2915-3071
/code/branches/presentation:2369-2652,2654-2660
/code/branches/presentation2:6106-6416
/code/branches/questsystem:1894-2088
/code/branches/questsystem2:2107-2259
/code/branches/questsystem5:2776-2905
/code/branches/resource:3327-3366
/code/branches/resource2:3372-5694
/code/branches/script_trigger:1295-1953,1955
/code/branches/sound:2829-3010
/code/branches/sound3:5941-6102
/code/branches/steering:5949-6091
/code/branches/weapon:1925-2094
/code/branches/weapon2:2107-2488
/code/branches/weapons:2897-3051
/code/branches/weaponsystem:2742-2890
   + /code/branches/buildsystem:1874-2276,2278-2400
/code/branches/buildsystem2:2506-2658
/code/branches/buildsystem3:2662-2708
/code/branches/ceguilua:1802-1808
/code/branches/console:5941-6104
/code/branches/core3:1572-1739
/code/branches/core4:3221-3224,3227,3234-3238,3242,3244-3250,3252-3254,3256,3259-3261,3264-3265,3268-3275,3277-3278,3280,3284-3285,3287,3289-3294,3305,3309-3310
/code/branches/core5:5768-5928,6009
/code/branches/gametypes:2826-3031
/code/branches/gcc43:1580
/code/branches/gui:1635-1723,2795-2894
/code/branches/ingamemenu:6000-6023
/code/branches/input:1629-1636
/code/branches/libraries:5612-5692
/code/branches/libraries2:5703-5737
/code/branches/lodfinal:2372-2411
/code/branches/map:2801-3086,3089
/code/branches/menu:5941-6146,6148
/code/branches/miniprojects:2754-2824
/code/branches/netp2:2835-2988
/code/branches/netp3:2988-3082
/code/branches/netp6:3214-3302
/code/branches/network:2356
/code/branches/network64:2210-2355
/code/branches/objecthierarchy:1911-2085,2100,2110-2169
/code/branches/objecthierarchy2:2171-2479
/code/branches/overlay:2117-2385
/code/branches/particles:2829-3085
/code/branches/particles2:6050-6106,6109
/code/branches/pch:3113-3194
/code/branches/physics:1912-2055,2107-2439
/code/branches/physics_merge:2436-2457
/code/branches/pickups:1926-2086,2127,2827-2915
/code/branches/pickups2:2107-2497,2915-3071
/code/branches/presentation:2369-2652,2654-2660
/code/branches/presentation2:6106-6416
/code/branches/questsystem:1894-2088
/code/branches/questsystem2:2107-2259
/code/branches/questsystem5:2776-2905
/code/branches/resource:3327-3366
/code/branches/resource2:3372-5694
/code/branches/script_trigger:1295-1953,1955
/code/branches/sound:2829-3010
/code/branches/sound3:5941-6102
/code/branches/steering:5949-6091
/code/branches/tutorial:5765-5840
/code/branches/weapon:1925-2094
/code/branches/weapon2:2107-2488
/code/branches/weapons:2897-3051
/code/branches/weaponsystem:2742-2890

Modified: code/branches/tutorial/data/levels/tutorial.oxw
===================================================================
--- code/branches/tutorial/data/levels/tutorial.oxw	2010-03-07 21:04:01 UTC (rev 6481)
+++ code/branches/tutorial/data/levels/tutorial.oxw	2010-03-07 21:11:31 UTC (rev 6482)
@@ -13,7 +13,7 @@
    skybox       = "Orxonox/skypanoramagen1"
   >
 
-<Drone name="meineDrohne" primarythrust="80" auxilarythrust="10" rotationthrust="10" mass= "50" linearDamping = "0.9" angularDamping = "0.7">
+<Drone name="meineDrohne" position="0,0,-10" primarythrust="80" auxilarythrust="10" rotationthrust="10" mass= "50" linearDamping = "0.9" angularDamping = "0.7">
   <attached>
     <Model scale="10" mesh="drone.mesh"/>
   </attached>


Property changes on: code/branches/tutorial/src/orxonox/controllers
___________________________________________________________________
Added: svn:mergeinfo
   + /code/branches/buildsystem/src/orxonox/controllers:1874-2276,2278-2400
/code/branches/buildsystem2/src/orxonox/controllers:2506-2658
/code/branches/buildsystem3/src/orxonox/controllers:2662-2708
/code/branches/ceguilua/src/orxonox/controllers:1802-1808
/code/branches/console/src/orxonox/controllers:5941-6104
/code/branches/core3/src/orxonox/controllers:1572-1739
/code/branches/core4/src/orxonox/controllers:3221-3224,3227,3234-3238,3242,3244-3250,3252-3254,3256,3259-3261,3264-3265,3268-3275,3277-3278,3280,3284-3285,3287,3289-3294,3305,3309-3310
/code/branches/core5/src/orxonox/controllers:5768-5928,6009
/code/branches/gametypes/src/orxonox/controllers:2826-3031
/code/branches/gcc43/src/orxonox/controllers:1580
/code/branches/gui/src/orxonox/controllers:1635-1723,2795-2894
/code/branches/ingamemenu/src/orxonox/controllers:6000-6023
/code/branches/input/src/orxonox/controllers:1629-1636
/code/branches/libraries/src/orxonox/controllers:5612-5692
/code/branches/libraries2/src/orxonox/controllers:5703-5737
/code/branches/lodfinal/src/orxonox/controllers:2372-2411
/code/branches/map/src/orxonox/controllers:2801-3086,3089
/code/branches/menu/src/orxonox/controllers:5941-6146,6148
/code/branches/miniprojects/src/orxonox/controllers:2754-2824
/code/branches/netp2/src/orxonox/controllers:2835-2988
/code/branches/netp3/src/orxonox/controllers:2988-3082
/code/branches/netp6/src/orxonox/controllers:3214-3302
/code/branches/network/src/orxonox/controllers:2356
/code/branches/network64/src/orxonox/controllers:2210-2355
/code/branches/objecthierarchy/src/orxonox/controllers:1911-2085,2100,2110-2169
/code/branches/objecthierarchy2/src/orxonox/controllers:2171-2479
/code/branches/overlay/src/orxonox/controllers:2117-2385
/code/branches/particles/src/orxonox/controllers:2829-3085
/code/branches/particles2/src/orxonox/controllers:6050-6106,6109
/code/branches/pch/src/orxonox/controllers:3113-3194
/code/branches/physics/src/orxonox/controllers:1912-2055,2107-2439
/code/branches/physics_merge/src/orxonox/controllers:2436-2457
/code/branches/pickups/src/orxonox/controllers:1926-2086,2127,2827-2915
/code/branches/pickups2/src/orxonox/controllers:2107-2497,2915-3071
/code/branches/presentation/src/orxonox/controllers:2369-2652,2654-2660
/code/branches/presentation2/src/orxonox/controllers:6106-6416
/code/branches/questsystem/src/orxonox/controllers:1894-2088
/code/branches/questsystem2/src/orxonox/controllers:2107-2259
/code/branches/questsystem5/src/orxonox/controllers:2776-2905
/code/branches/resource/src/orxonox/controllers:3327-3366
/code/branches/resource2/src/orxonox/controllers:3372-5694
/code/branches/script_trigger/src/orxonox/controllers:1295-1953,1955
/code/branches/sound/src/orxonox/controllers:2829-3010
/code/branches/sound3/src/orxonox/controllers:5941-6102
/code/branches/steering/src/orxonox/controllers:5949-6091
/code/branches/tutorial/src/orxonox/controllers:5765-5840
/code/branches/tutorial/src/orxonox/objects/controllers:2761-2765
/code/branches/weapon/src/orxonox/controllers:1925-2094
/code/branches/weapon2/src/orxonox/controllers:2107-2488
/code/branches/weapons/src/orxonox/controllers:2897-3051
/code/branches/weaponsystem/src/orxonox/controllers:2742-2890

Modified: code/branches/tutorial/src/orxonox/controllers/CMakeLists.txt
===================================================================
--- code/branches/tutorial/src/orxonox/controllers/CMakeLists.txt	2010-03-07 21:04:01 UTC (rev 6481)
+++ code/branches/tutorial/src/orxonox/controllers/CMakeLists.txt	2010-03-07 21:11:31 UTC (rev 6482)
@@ -4,6 +4,7 @@
   NewHumanController.cc
   ArtificialController.cc
   AIController.cc
+  DroneController.cc
   ScriptController.cc
   WaypointController.cc
   WaypointPatrolController.cc

Copied: code/branches/tutorial/src/orxonox/controllers/DroneController.cc (from rev 5840, code/branches/tutorial/src/orxonox/controllers/DroneController.cc)
===================================================================
--- code/branches/tutorial/src/orxonox/controllers/DroneController.cc	                        (rev 0)
+++ code/branches/tutorial/src/orxonox/controllers/DroneController.cc	2010-03-07 21:11:31 UTC (rev 6482)
@@ -0,0 +1,76 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   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
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Oli Scheuss
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#include "DroneController.h"
+#include "worldentities/Drone.h"
+#include "util/Math.h"
+
+
+namespace orxonox
+{
+    /**
+    @brief
+        Constructor.
+    */
+    DroneController::DroneController(BaseObject* creator) : Controller(creator)
+    {
+        // Place your code here:
+        // - make sure to register the object in the factory
+        // - do any kind of initialisation
+        RegisterObject(DroneController);
+        
+        // this checks that our creator really is a drone
+        // and saves the pointer to the drone for the controlling commands
+        assert(dynamic_cast<Drone*>(creator)!=0);
+        this->setControllableEntity(dynamic_cast<Drone*>(creator));
+    }
+
+    DroneController::~DroneController()
+    {
+    }
+
+    /**
+    @brief
+        The controlling happens here. This method defines what the controller has to do each tick.
+    @param dt
+        The duration of the tick.
+    */
+    void DroneController::tick(float dt)
+    {
+        // Place your code here:
+        // - steering commands
+        static float totaltime = 0;
+        totaltime += dt;
+        Drone *myDrone = static_cast<Drone*>(this->getControllableEntity());
+        if(totaltime<100)
+        {
+            myDrone->moveFrontBack( -sqrt(dt) );
+            myDrone->rotatePitch(-dt);
+        }
+    }
+}

Copied: code/branches/tutorial/src/orxonox/controllers/DroneController.h (from rev 5840, code/branches/tutorial/src/orxonox/controllers/DroneController.h)
===================================================================
--- code/branches/tutorial/src/orxonox/controllers/DroneController.h	                        (rev 0)
+++ code/branches/tutorial/src/orxonox/controllers/DroneController.h	2010-03-07 21:11:31 UTC (rev 6482)
@@ -0,0 +1,59 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   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
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Oli Scheuss
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#ifndef _DroneController_H__
+#define _DroneController_H__
+
+#include "OrxonoxPrereqs.h"
+
+#include "Controller.h"
+#include "tools/interfaces/Tickable.h"
+
+namespace orxonox
+{
+    /**
+    @brief
+        Controller for the Drone of the PPS tutorial.
+    @author
+        Oli Scheuss
+    */
+    class _OrxonoxExport DroneController : public Controller, public Tickable
+    {
+        public:
+            DroneController(BaseObject* creator);
+            virtual ~DroneController();
+            
+            virtual void tick(float dt); //!< The controlling happens here. This method defines what the controller has to do each tick.
+
+        protected:
+
+        private:
+    };
+}
+
+#endif /* _DroneController_H__ */

Modified: code/branches/tutorial/src/orxonox/pickup/BaseItem.h
===================================================================
--- code/branches/tutorial/src/orxonox/pickup/BaseItem.h	2010-03-07 21:04:01 UTC (rev 6481)
+++ code/branches/tutorial/src/orxonox/pickup/BaseItem.h	2010-03-07 21:11:31 UTC (rev 6482)
@@ -43,12 +43,12 @@
 namespace orxonox
 {
     /**
-        @brief
-            Base class for all items/pickups.
+    @brief
+        Base class for all items/pickups.
 
-            Provides common methods to be used in derived classes.
-        @author
-            Daniel 'Huty' Haggenmueller
+        Provides common methods to be used in derived classes.
+    @author
+        Daniel 'Huty' Haggenmueller
     */
     class _OrxonoxExport BaseItem : public BaseObject
     {
@@ -60,8 +60,8 @@
         virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);  //!< XMLPort
 
         /**
-            @brief Checks how many instances of this item can be carried at a time.
-            @return How many of this item can be carried.
+        @brief Checks how many instances of this item can be carried at a time.
+        @return How many of this item can be carried.
         */
         virtual int getMaxCarryAmount() const
             { return 1; }
@@ -69,14 +69,14 @@
         bool addTo(Pawn* pawn);             //!< Add the item to a pawn.
         bool removeFrom(Pawn* pawn);        //!< Removes the item from a pawn.
         /**
-            @brief
-                Method invoked when the item gets picked up.
+        @brief
+            Method invoked when the item gets picked up.
 
-                Has to be overridden for an item to work,
-                should contain a call to addTo().
+            Has to be overridden for an item to work,
+            should contain a call to addTo().
 
-            @param pawn Pawn who picks up the item.
-            @return Returns whether the pawn was able to pick up the item.
+        @param pawn Pawn who picks up the item.
+        @return Returns whether the pawn was able to pick up the item.
         */
         virtual bool pickedUp(Pawn* pawn)
             { return false; }


Property changes on: code/branches/tutorial/src/orxonox/worldentities
___________________________________________________________________
Added: svn:mergeinfo
   + /code/branches/buildsystem/src/orxonox/worldentities:1874-2276,2278-2400
/code/branches/buildsystem2/src/orxonox/worldentities:2506-2658
/code/branches/buildsystem3/src/orxonox/worldentities:2662-2708
/code/branches/ceguilua/src/orxonox/worldentities:1802-1808
/code/branches/console/src/orxonox/worldentities:5941-6104
/code/branches/core3/src/orxonox/worldentities:1572-1739
/code/branches/core4/src/orxonox/worldentities:3221-3224,3227,3234-3238,3242,3244-3250,3252-3254,3256,3259-3261,3264-3265,3268-3275,3277-3278,3280,3284-3285,3287,3289-3294,3305,3309-3310
/code/branches/core5/src/orxonox/worldentities:5768-5928,6009
/code/branches/gametypes/src/orxonox/worldentities:2826-3031
/code/branches/gcc43/src/orxonox/worldentities:1580
/code/branches/gui/src/orxonox/worldentities:1635-1723,2795-2894
/code/branches/ingamemenu/src/orxonox/worldentities:6000-6023
/code/branches/input/src/orxonox/worldentities:1629-1636
/code/branches/libraries/src/orxonox/worldentities:5612-5692
/code/branches/libraries2/src/orxonox/worldentities:5703-5737
/code/branches/lodfinal/src/orxonox/worldentities:2372-2411
/code/branches/map/src/orxonox/worldentities:2801-3086,3089
/code/branches/menu/src/orxonox/worldentities:5941-6146,6148
/code/branches/miniprojects/src/orxonox/worldentities:2754-2824
/code/branches/netp2/src/orxonox/worldentities:2835-2988
/code/branches/netp3/src/orxonox/worldentities:2988-3082
/code/branches/netp6/src/orxonox/worldentities:3214-3302
/code/branches/network/src/orxonox/worldentities:2356
/code/branches/network64/src/orxonox/worldentities:2210-2355
/code/branches/objecthierarchy/src/orxonox/worldentities:1911-2085,2100,2110-2169
/code/branches/objecthierarchy2/src/orxonox/worldentities:2171-2479
/code/branches/overlay/src/orxonox/worldentities:2117-2385
/code/branches/particles/src/orxonox/worldentities:2829-3085
/code/branches/particles2/src/orxonox/worldentities:6050-6106,6109
/code/branches/pch/src/orxonox/worldentities:3113-3194
/code/branches/physics/src/orxonox/worldentities:1912-2055,2107-2439
/code/branches/physics_merge/src/orxonox/worldentities:2436-2457
/code/branches/pickups/src/orxonox/worldentities:1926-2086,2127,2827-2915
/code/branches/pickups2/src/orxonox/worldentities:2107-2497,2915-3071
/code/branches/presentation/src/orxonox/worldentities:2369-2652,2654-2660
/code/branches/presentation2/src/orxonox/worldentities:6106-6416
/code/branches/questsystem/src/orxonox/worldentities:1894-2088
/code/branches/questsystem2/src/orxonox/worldentities:2107-2259
/code/branches/questsystem5/src/orxonox/worldentities:2776-2905
/code/branches/resource/src/orxonox/worldentities:3327-3366
/code/branches/resource2/src/orxonox/worldentities:3372-5694
/code/branches/script_trigger/src/orxonox/worldentities:1295-1953,1955
/code/branches/sound/src/orxonox/worldentities:2829-3010
/code/branches/sound3/src/orxonox/worldentities:5941-6102
/code/branches/steering/src/orxonox/worldentities:5949-6091
/code/branches/tutorial/src/orxonox/objects/worldentities:2761-2765
/code/branches/tutorial/src/orxonox/worldentities:5765-5840
/code/branches/weapon/src/orxonox/worldentities:1925-2094
/code/branches/weapon2/src/orxonox/worldentities:2107-2488
/code/branches/weapons/src/orxonox/worldentities:2897-3051
/code/branches/weaponsystem/src/orxonox/worldentities:2742-2890

Modified: code/branches/tutorial/src/orxonox/worldentities/CMakeLists.txt
===================================================================
--- code/branches/tutorial/src/orxonox/worldentities/CMakeLists.txt	2010-03-07 21:04:01 UTC (rev 6481)
+++ code/branches/tutorial/src/orxonox/worldentities/CMakeLists.txt	2010-03-07 21:11:31 UTC (rev 6482)
@@ -6,6 +6,7 @@
   ControllableEntity.cc
 
   BigExplosion.cc
+  Drone.cc
   EffectContainer.cc
   ExplosionChunk.cc
   CameraPosition.cc

Copied: code/branches/tutorial/src/orxonox/worldentities/Drone.cc (from rev 5840, code/branches/tutorial/src/orxonox/worldentities/Drone.cc)
===================================================================
--- code/branches/tutorial/src/orxonox/worldentities/Drone.cc	                        (rev 0)
+++ code/branches/tutorial/src/orxonox/worldentities/Drone.cc	2010-03-07 21:11:31 UTC (rev 6482)
@@ -0,0 +1,180 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   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
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Oli Scheuss
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#include "Drone.h"
+
+#include "core/XMLPort.h"
+#include "BulletDynamics/Dynamics/btRigidBody.h"
+
+namespace orxonox
+{
+    // put your code in here:
+    // create the factory for the drone
+    CreateFactory(Drone);
+
+    /**
+    @brief
+        Constructor. Registers the object and initializes some default values.
+    */
+    Drone::Drone(BaseObject* creator) : ControllableEntity(creator)
+    {
+        // put your code in here:
+        // - register the drone class to the core
+        // - create a new controller and pass our this pointer to it as creator
+        this->myController_ = 0;
+        RegisterObject(Drone);
+        
+        this->localLinearAcceleration_.setValue(0, 0, 0);
+        this->localAngularAcceleration_.setValue(0, 0, 0);
+        this->primaryThrust_  = 100;
+        this->auxilaryThrust_ = 100;
+        this->rotationThrust_ = 10;
+        
+        this->setCollisionType(WorldEntity::Dynamic);
+        
+        myController_ = new DroneController(static_cast<BaseObject*>(this));
+    }
+
+    /**
+    @brief
+        Destructor. Destroys controller, if present.
+    */
+    Drone::~Drone()
+    {
+        if( this->myController_ )
+            delete this->myController_;
+    }
+
+    /**
+    @brief
+        Method for creating a Drone through XML.
+    */
+    void Drone::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+    {
+        // this calls the XMLPort function of the parent class
+        SUPER(Drone, XMLPort, xmlelement, mode);
+
+        XMLPortParam(Drone, "primaryThrust",  setPrimaryThrust, getPrimaryThrust,  xmlelement, mode);
+        XMLPortParam(Drone, "auxilaryThrust", setAuxilaryThrust, getAuxilaryThrust, xmlelement, mode);
+        XMLPortParam(Drone, "rotationThrust", setRotationThrust, getRotationThrust, xmlelement, mode);
+    }
+
+    /**
+    @brief
+        Defines which actions the Drone has to take in each tick.
+    @param dt
+        The length of the tick.
+    */
+    void Drone::tick(float dt)
+    {
+        SUPER(Drone, tick, dt);
+        
+        //if (this->hasLocalController())
+        //{
+            this->localLinearAcceleration_.setX(this->localLinearAcceleration_.x() * getMass() * this->auxilaryThrust_);
+            this->localLinearAcceleration_.setY(this->localLinearAcceleration_.y() * getMass() * this->auxilaryThrust_);
+            if (this->localLinearAcceleration_.z() > 0)
+              this->localLinearAcceleration_.setZ(this->localLinearAcceleration_.z() * getMass() * this->auxilaryThrust_);
+            else
+              this->localLinearAcceleration_.setZ(this->localLinearAcceleration_.z() * getMass() * this->primaryThrust_);
+            this->physicalBody_->applyCentralForce(physicalBody_->getWorldTransform().getBasis() * this->localLinearAcceleration_);
+            this->localLinearAcceleration_.setValue(0, 0, 0);
+        
+            this->localAngularAcceleration_ *= this->getLocalInertia() * this->rotationThrust_;
+            this->physicalBody_->applyTorque(physicalBody_->getWorldTransform().getBasis() * this->localAngularAcceleration_);
+            this->localAngularAcceleration_.setValue(0, 0, 0);
+        //}
+    }
+    
+    /**
+    @brief
+        Moves the Drone in the negative z-direction (Front/Back) by an amount specified by the first component of the input 2-dim vector.
+    @param value
+        The vector determining the amount of the movement.
+    */
+    void Drone::moveFrontBack(const Vector2& value)
+    {
+        this->localLinearAcceleration_.setZ(this->localLinearAcceleration_.z() - value.x);
+    }
+
+    /**
+    @brief
+        Moves the Drone in the x-direction (Right/Left) by an amount specified by the first component of the input 2-dim vector.
+    @param value
+        The vector determining the amount of the movement.
+    */
+    void Drone::moveRightLeft(const Vector2& value)
+    {
+        this->localLinearAcceleration_.setX(this->localLinearAcceleration_.x() + value.x);
+    }
+
+    /**
+    @brief
+        Moves the Drone in the y-direction (Up/Down) by an amount specified by the first component of the input 2-dim vector.
+    @param value
+        The vector determining the amount of the movement.
+    */
+    void Drone::moveUpDown(const Vector2& value)
+    {
+        this->localLinearAcceleration_.setY(this->localLinearAcceleration_.y() + value.x);
+    }
+
+    /**
+    @brief
+        Rotates the Drone around the y-axis by the amount specified by the first component of the input 2-dim vector.
+    @param value
+        The vector determining the amount of the angular movement.
+    */
+    void Drone::rotateYaw(const Vector2& value)
+    {
+        this->localAngularAcceleration_.setY(this->localAngularAcceleration_.y() - value.x);
+    }
+
+    /**
+    @brief
+        Rotates the Drone around the x-axis by the amount specified by the first component of the input 2-dim vector.
+    @param value
+        The vector determining the amount of the angular movement.
+    */
+    void Drone::rotatePitch(const Vector2& value)
+    {
+        this->localAngularAcceleration_.setX(this->localAngularAcceleration_.x() + value.x);
+    }
+
+    /**
+    @brief
+        Rotates the Drone around the z-axis by the amount specified by the first component of the input 2-dim vector.
+    @param value
+        The vector determining the amount of the angular movement.
+    */
+    void Drone::rotateRoll(const Vector2& value)
+    {
+        this->localAngularAcceleration_.setZ(this->localAngularAcceleration_.z() + value.x);
+    }
+    
+}

Copied: code/branches/tutorial/src/orxonox/worldentities/Drone.h (from rev 5840, code/branches/tutorial/src/orxonox/worldentities/Drone.h)
===================================================================
--- code/branches/tutorial/src/orxonox/worldentities/Drone.h	                        (rev 0)
+++ code/branches/tutorial/src/orxonox/worldentities/Drone.h	2010-03-07 21:11:31 UTC (rev 6482)
@@ -0,0 +1,136 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   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
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Oli Scheuss
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#ifndef _Drone_H__
+#define _Drone_H__
+
+#include "OrxonoxPrereqs.h"
+#include "worldentities/ControllableEntity.h"
+#include "controllers/DroneController.h"
+
+namespace orxonox
+{
+
+    /**
+    @brief
+        Drone, that is made to move upon a specified pattern.
+        This class was constructed for the PPS tutorial.
+    @author
+        Oli Scheuss
+    */
+    class _OrxonoxExport Drone : public ControllableEntity
+    {
+        public:
+            Drone(BaseObject* creator);
+            virtual ~Drone();
+
+            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); //!< Method for creating a Drone through XML.
+            virtual void tick(float dt); //!< Defines which actions the Drone has to take in each tick.
+
+            
+            virtual void moveFrontBack(const Vector2& value);
+            virtual void moveRightLeft(const Vector2& value);
+            virtual void moveUpDown(const Vector2& value);
+
+            virtual void rotateYaw(const Vector2& value);
+            virtual void rotatePitch(const Vector2& value);
+            virtual void rotateRoll(const Vector2& value);
+            
+            /**
+            @brief Moves the Drone in the Front/Back-direction by the specifed amount.
+            @param value  The amount by which the drone is to be moved.
+            */
+            inline void moveFrontBack(float value)
+            { this->moveFrontBack(Vector2(value, 0)); }
+            /**
+            @brief Moves the Drone in the Right/Left-direction by the specifed amount.
+            @param value  The amount by which the drone is to be moved.
+            */
+            inline void moveRightLeft(float value)
+            { this->moveRightLeft(Vector2(value, 0)); }
+            /**
+            @brief Moves the Drone in the Up/Down-direction by the specifed amount.
+            @param value  The amount by which the drone is to be moved.
+            */
+            inline void moveUpDown(float value)
+            { this->moveUpDown(Vector2(value, 0)); }
+            
+            /**
+            @brief Rotates the Drone around the y-axis by the specifed amount.
+            @param value  The amount by which the drone is to be rotated.
+            */
+            inline void rotateYaw(float value)
+            { this->rotateYaw(Vector2(value, 0)); }
+            /**
+            @brief Rotates the Drone around the x-axis by the specifed amount.
+            @param value  The amount by which the drone is to be rotated.
+            */
+            inline void rotatePitch(float value)
+            { this->rotatePitch(Vector2(value, 0)); }
+            /**
+            @brief Rotates the Drone around the z-axis by the specifed amount.
+            @param value  The amount by which the drone is to be rotated.
+            */
+            inline void rotateRoll(float value)
+            { this->rotateRoll(Vector2(value, 0)); }
+            
+            /**
+            @brief Sets the primary thrust to the input amount.
+            @param thrust The amount of thrust.
+            */
+            inline void setPrimaryThrust( float thrust )
+                { this->primaryThrust_=thrust; }            
+            inline void setAuxilaryThrust( float thrust )
+                { this->auxilaryThrust_=thrust; }
+            inline void setRotationThrust( float thrust )
+                { this->rotationThrust_=thrust; }
+            
+            /**
+            @brief Gets the primary thrust to the input amount.
+            @preturn The amount of thrust.
+            */
+            inline float getPrimaryThrust()
+                { return this->primaryThrust_; }
+            inline float getAuxilaryThrust()
+                { return this->auxilaryThrust_; }
+            inline float getRotationThrust()
+                { return this->rotationThrust_; }
+            
+        private:
+            DroneController *myController_; //!< The controller of the Drone.
+            
+            btVector3 localLinearAcceleration_; //!< The linear acceleration that is used to move the Drone the next tick.
+            btVector3 localAngularAcceleration_; //!< The linear angular acceleration that is used to move the Drone the next tick.
+            float primaryThrust_; //!< The amount of primary thrust. This is just used, when moving forward. 
+            float auxilaryThrust_; //!< The amount of auxilary thrust. Used for all other movements (except for rotations).
+            float rotationThrust_; //!< The amount of rotation thrust. Used for rotations only.
+    };
+
+}
+
+#endif /* _Drone_H__ */




More information about the Orxonox-commit mailing list