|
Last change
on this file since 1295 was
977,
checked in by scheusso, 18 years ago
|
|
more adjustments for synchronisation
|
|
File size:
1.4 KB
|
| Rev | Line | |
|---|
| [603] | 1 | /** |
|---|
| 2 | @file NPC.h |
|---|
| 3 | @brief AI using WorldEntity |
|---|
| 4 | @author Benjamin Knecht <beni_at_orxonox.net> |
|---|
| 5 | */ |
|---|
| 6 | |
|---|
| [673] | 7 | #ifndef _NPC_H__ |
|---|
| 8 | #define _NPC_H__ |
|---|
| [603] | 9 | |
|---|
| [977] | 10 | #include "../OrxonoxPrereqs.h" |
|---|
| 11 | |
|---|
| [617] | 12 | #include "Model.h" |
|---|
| [603] | 13 | |
|---|
| [708] | 14 | class TiXmlElement; // Forward declaration |
|---|
| 15 | |
|---|
| [603] | 16 | namespace orxonox { |
|---|
| 17 | |
|---|
| [729] | 18 | class _OrxonoxExport NPC : public Model |
|---|
| [603] | 19 | { |
|---|
| [617] | 20 | public: |
|---|
| 21 | |
|---|
| 22 | NPC(); |
|---|
| 23 | virtual ~NPC(); |
|---|
| [627] | 24 | virtual void loadParams(TiXmlElement* xmlElem); |
|---|
| [617] | 25 | void tick(float dt); |
|---|
| [619] | 26 | void update(); |
|---|
| [617] | 27 | void setValues(Vector3 location, Vector3 speed, Vector3 acceleration, bool movable); |
|---|
| [977] | 28 | void registerAllVariables(); |
|---|
| 29 | bool create(); |
|---|
| [617] | 30 | |
|---|
| 31 | private: |
|---|
| [627] | 32 | float getDistance(WorldEntity* temp); |
|---|
| 33 | void calculateAcceleration(); |
|---|
| 34 | Vector3 separation(); |
|---|
| 35 | Vector3 alignment(); |
|---|
| 36 | Vector3 cohesion(); |
|---|
| [617] | 37 | |
|---|
| 38 | |
|---|
| 39 | private: |
|---|
| 40 | bool movable_; // movability of the element, (false) gives the possiblity that an object can`t be moved by flocking but still gets into the calculation |
|---|
| 41 | |
|---|
| 42 | // those values should maybe be controlled by a higher power and should maybe be parameters that can be changed |
|---|
| 43 | static int const SEPERATIONDISTANCE = 300; //detectionradius of seperation |
|---|
| 44 | static int const ALIGNMENTDISTANCE = 300; //detectionradius of alignment |
|---|
| 45 | static int const COHESIONDISTANCE = 5000; //detectionradius of cohesion |
|---|
| [728] | 46 | static int const NUMELEMENTS = 9; //number of elements |
|---|
| [603] | 47 | }; |
|---|
| 48 | } |
|---|
| [673] | 49 | #endif /* _NPC_H__ */ |
|---|
Note: See
TracBrowser
for help on using the repository browser.