Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

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

separated MasterController from my hierarchy

File size: 4.6 KB
RevLine 
[10871]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:
[10886]23 *      Gani Aliguzhinov
[10871]24 *   Co-authors:
[10886]25 *      Dominik Solenicki
[10871]26 *
27 */
28
29#ifndef _FlyingController_H__
30#define _FlyingController_H__
31
32
33#include "controllers/CommonController.h"
34
35namespace orxonox
36{   
[10898]37    /**
38    @brief
39        FlyingController stores all the flying methods and member variables of AI.
40    */
[10946]41
42    //Formation mode for the divisions
[10871]43    namespace FormationMode
44    {
45        enum Value
46        {
47            FINGER4, DIAMOND, WALL
48        };
49    }
50
51    class _OrxonoxExport FlyingController : public CommonController
52    {
53
54        public:
[10946]55            static const float SPEED = 0.9f/0.02f;              //<! ship's speed
56            static const float ROTATEFACTOR = 0.6f/0.02f;       //<! ship's rotation factor
[10877]57 
[10871]58            FlyingController(Context* context);
59            virtual ~FlyingController();
60            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
61
[10946]62            void setSpread (int spread)                         //<! spread is a multiplier for formation flight, should be bigger than 100
[10871]63                { this->spread_ = spread; }
[10946]64            int getSpread () const                             
[10871]65                { return this->spread_; }
66
67            void setFormationModeXML(std::string val);
[10885]68            std::string getFormationModeXML() const;
[10871]69
70            void setFormationMode(FormationMode::Value val)
71                { this->formationMode_ = val; }
72            FormationMode::Value getFormationMode() const
73                { return this->formationMode_; }
[10958]74            bool bCopyOrientation_;                             //<! set to true by default, MasterController sets it in its tick(),
75                                                                //<! if true, this will set its leader orientation as target orientation in action()
[10871]76        protected:
[10946]77            void stopMoving();                                  //<! don't call moveToTargetPosition() in tick, call lookAtTarget() from FightingController instead
[10871]78
[10946]79            void moveToPosition(const Vector3& target, float dt);   //<! move towards a vector
80            void moveToTargetPosition(float dt);                    //<! move to the preset position. Don't mix with positionOfTarget!
[10871]81
[10946]82            void copyOrientation(const Quaternion& orient, float dt);   //<! roll to have same roll as orient
83            void copyTargetOrientation(float dt);                       //<! roll to have a preset orient
[10871]84
[10946]85            void setTargetPosition(const Vector3& target);              //<! preset a Vector to fly to
86            void setTargetOrientation(const Quaternion& orient);        //<! preset a desired orientation
87            void setTargetOrientation(ControllableEntity* target);      //<! preset a desired orientation
88            virtual void boostControl();                                //<! boost if you can
[10958]89            void keepFormation (const ControllableEntity* leaderEntity, 
90                                Vector3& targetRelativePosition);   //<! preset targetPosition, so that
91                                                                    //<! this stays in a certain position relative to leader     
[10923]92           
[10871]93            FormationMode::Value formationMode_;
94         
[10946]95            float rotationProgress_;    //<! for slerping
[10871]96            bool bHasTargetPosition_;
[10946]97            Vector3 targetPosition_;    //<! vector to fly to
[10871]98            bool bHasTargetOrientation_;
[10946]99            Quaternion targetOrientation_;  //<! orientation to take
100            int spread_;                //<! spread is a multiplier for formation flight, should be bigger than 100
101            int tolerance_;             //<! if this ship is tolerance_ away from targetPosition_, ship decides that it finished moving
[10871]102    };
103}
104
105#endif /* _FlyingController_H__ */
Note: See TracBrowser for help on using the repository browser.