Orxonox  0.0.5 Codename: Arcturus
FlyingController.h
Go to the documentation of this file.
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 
34 
35 namespace orxonox
36 {
42  //Formation mode for the divisions
43  enum class FormationMode
44  {
46  };
47 
49  {
50 
51  public:
52  static const float SPEED; //<! ship's speed
53  static const float ROTATEFACTOR; //<! ship's rotation factor
54 
55  FlyingController(Context* context);
56  virtual ~FlyingController();
57  virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override;
58 
59  void setSpread (int spread) //<! spread is a multiplier for formation flight, should be bigger than 100
60  { this->spread_ = spread; }
61  int getSpread () const
62  { return this->spread_; }
63 
64  void setFormationModeXML(const std::string& val);
65  std::string getFormationModeXML() const;
66 
68  { this->formationMode_ = val; }
70  { return this->formationMode_; }
71  bool bCopyOrientation_; //<! set to true by default, MasterController sets it in its tick(),
72  //<! if true, this will set its leader orientation as target orientation in action()
73  protected:
74  void stopMoving(); //<! don't call moveToTargetPosition() in tick, call lookAtTarget() from FightingController instead
75 
76  void moveToPosition(const Vector3& target, float dt); //<! move towards a vector
77  void moveToTargetPosition(float dt); //<! move to the preset position. Don't mix with positionOfTarget!
78 
79  void copyOrientation(const Quaternion& orient, float dt); //<! roll to have same roll as orient
80  void copyTargetOrientation(float dt); //<! roll to have a preset orient
81 
82  void setTargetPosition(const Vector3& target); //<! preset a Vector to fly to
83  void setTargetOrientation(const Quaternion& orient); //<! preset a desired orientation
84  void setTargetOrientation(ControllableEntity* target); //<! preset a desired orientation
85  virtual void boostControl(); //<! boost if you can
86  void keepFormation (const ControllableEntity* leaderEntity,
87  Vector3& targetRelativePosition); //<! preset targetPosition, so that
88  //<! this stays in a certain position relative to leader
89 
91 
92  float rotationProgress_; //<! for slerping
94  Vector3 targetPosition_; //<! vector to fly to
96  Quaternion targetOrientation_; //<! orientation to take
97  int spread_; //<! spread is a multiplier for formation flight, should be bigger than 100
98  int tolerance_; //<! if this ship is tolerance_ away from targetPosition_, ship decides that it finished moving
99  };
100 }
101 
102 #endif /* _FlyingController_H__ */
FormationMode getFormationMode() const
Definition: FlyingController.h:69
Quaternion targetOrientation_
Definition: FlyingController.h:96
void setSpread(int spread)
Definition: FlyingController.h:59
FormationMode
FlyingController stores all the flying methods and member variables of AI.
Definition: FlyingController.h:43
::std::string string
Definition: gtest-port.h:756
int getSpread() const
Definition: FlyingController.h:61
bool bHasTargetOrientation_
Definition: FlyingController.h:95
xmlelement
Definition: Super.h:519
static const float SPEED
Definition: FlyingController.h:52
Die Wagnis Klasse hat die folgenden Aufgaben:
Definition: ApplicationPaths.cc:66
Mode
Definition: CorePrereqs.h:102
Definition: CommonController.h:43
Definition: FlyingController.h:48
bool bCopyOrientation_
Definition: FlyingController.h:71
FormationMode formationMode_
Definition: FlyingController.h:90
Definition: Context.h:45
#define _OrxonoxExport
Definition: OrxonoxPrereqs.h:60
Vector3 targetPosition_
Definition: FlyingController.h:94
void setFormationMode(FormationMode val)
Definition: FlyingController.h:67
int tolerance_
Definition: FlyingController.h:98
bool bHasTargetPosition_
Definition: FlyingController.h:93
static const float ROTATEFACTOR
Definition: FlyingController.h:53
float rotationProgress_
Definition: FlyingController.h:92
The ControllableEntity is derived from the orxonox::MobileEntity.
Definition: ControllableEntity.h:48
int spread_
Definition: FlyingController.h:97