Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/campaignHS15/src/orxonox/controllers/FlyingController.h @ 10882

Last change on this file since 10882 was 10881, checked in by gania, 9 years ago

finished fixing FlyingController: AI is flying as smooth as possible with minimum loss of performance

File size: 2.9 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 *      Fabian 'x3n' Landau
24 *   Co-authors:
25 *      ...
26 *
27 */
28
29#ifndef _FlyingController_H__
30#define _FlyingController_H__
31
32
33#include "controllers/CommonController.h"
34
35namespace orxonox
36{   
37    namespace FormationMode
38    {
39        enum Value
40        {
41            FINGER4, DIAMOND, WALL
42        };
43    }
44
45    class _OrxonoxExport FlyingController : public CommonController
46    {
47
48        public:
49            static const float SPEED = 0.9f/0.02f;
50            static const float ROTATEFACTOR = 0.6f/0.02f;
51 
52            FlyingController(Context* context);
53            virtual ~FlyingController();
54            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
55
56            void setSpread (int spread)
57                { this->spread_ = spread; }
58            int getSpread ()
59                { return this->spread_; }
60
61            void setFormationModeXML(std::string val);
62            std::string getFormationModeXML();
63
64            void setFormationMode(FormationMode::Value val)
65                { this->formationMode_ = val; }
66            FormationMode::Value getFormationMode() const
67                { return this->formationMode_; }
68
69        protected:
70            void stopMoving();
71
72            void moveToPosition(const Vector3& target, float dt);
73            void moveToTargetPosition(float dt);
74
75            void copyOrientation(const Quaternion& orient, float dt);
76            void copyTargetOrientation(float dt);
77
78            void setTargetPosition(const Vector3& target);
79            void setTargetOrientation(const Quaternion& orient);
80            void setTargetOrientation(ControllableEntity* target);
81            virtual void boostControl();       
82            FormationMode::Value formationMode_;
83         
84            float rotationProgress_;
85            int actionCounter_;
86            bool bHasTargetPosition_;
87            Vector3 targetPosition_;
88            bool bHasTargetOrientation_;
89            Quaternion targetOrientation_; 
90            int spread_;
91            int tolerance_; 
92    };
93}
94
95#endif /* _FlyingController_H__ */
Note: See TracBrowser for help on using the repository browser.