Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

Last change on this file since 10923 was 10923, checked in by gania, 8 years ago

check in

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