Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/tutorial/src/orxonox/controllers/AutonomousDroneController.cc @ 8012

Last change on this file since 8012 was 8012, checked in by dafrick, 13 years ago

Committing muster-lösung.

File size: 2.5 KB
Line 
1/*
2 *   ORXONOX - the hottest 3D action shooter ever to exist
3 *                    > www.orxonox.net <
4 *
5 *
6 *   License notice:
7 *
8 *   This program is free software; you can redistribute it and/or
9 *   modify it under the terms of the GNU General Public License
10 *   as published by the Free Software Foundation; either version 2
11 *   of the License, or (at your option) any later version.
12 *
13 *   This program is distributed in the hope that it will be useful,
14 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
15 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 *   GNU General Public License for more details.
17 *
18 *   You should have received a copy of the GNU General Public License
19 *   along with this program; if not, write to the Free Software
20 *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
21 *
22 *   Author:
23 *      Oli Scheuss
24 *   Co-authors:
25 *      Damian 'Mozork' Frick
26 *
27 */
28
29#include "AutonomousDroneController.h"
30
31#include "worldentities/AutonomousDrone.h"
32#include "util/Math.h"
33
34namespace orxonox
35{
36
37    CreateFactory(AutonomousDroneController);
38
39    /**
40    @brief
41        Constructor.
42    @param creator
43        The creator of this object.
44    */
45    AutonomousDroneController::AutonomousDroneController(BaseObject* creator) : Controller(creator)
46    {
47        //TODO: Place your code here:
48        // Make sure to register the object in the factory.
49        // Do some kind of initialisation.
50        RegisterObject(AutonomousDroneController);
51
52        // This checks that our creator really is a drone
53        // and saves the pointer to the drone for the controlling commands
54        AutonomousDrone* drone = dynamic_cast<AutonomousDrone*>(creator);
55        assert(drone != NULL);
56        this->setControllableEntity(drone);
57    }
58
59    /**
60    @brief
61        Destructor.
62    */
63    AutonomousDroneController::~AutonomousDroneController()
64    {
65
66    }
67
68    /**
69    @brief
70        The controlling happens here. This method defines what the controller has to do each tick.
71    @param dt
72        The duration of the tick.
73    */
74    void AutonomousDroneController::tick(float dt)
75    {
76        AutonomousDrone *myDrone = static_cast<AutonomousDrone*>(this->getControllableEntity());
77        //TODO: Place your code here:
78        // Steering commands
79        // You can use the following commands for steering
80        // - moveFrontBack, moveRightLeft, moveUpDown
81        // - rotatePitch, rotateYaw, rotateRoll
82        // Apply the to myDrone (e.g. myDrone->rotateYaw(..) )
83        myDrone->rotateYaw(dt);
84
85    }
86}
Note: See TracBrowser for help on using the repository browser.