Rev | Line | |
---|
[603] | 1 | /** |
---|
| 2 | @file NPC.h |
---|
| 3 | @brief AI using WorldEntity |
---|
| 4 | @author Benjamin Knecht <beni_at_orxonox.net> |
---|
| 5 | */ |
---|
| 6 | |
---|
| 7 | #ifndef MODULE_NPC_H |
---|
| 8 | #define MODULE_NPC_H |
---|
| 9 | |
---|
| 10 | // includes |
---|
| 11 | #include "WorldEntity.h" |
---|
[617] | 12 | #include "Model.h" |
---|
[603] | 13 | |
---|
| 14 | namespace orxonox { |
---|
| 15 | |
---|
[617] | 16 | class NPC : public Model |
---|
[603] | 17 | { |
---|
[617] | 18 | public: |
---|
| 19 | |
---|
| 20 | NPC(); |
---|
| 21 | virtual ~NPC(); |
---|
| 22 | void tick(float dt); |
---|
[619] | 23 | void update(); |
---|
[617] | 24 | void setValues(Vector3 location, Vector3 speed, Vector3 acceleration, bool movable); |
---|
| 25 | |
---|
| 26 | private: |
---|
| 27 | float getDistance(NPC* temp); |
---|
| 28 | void calculateAcceleration(NPC** arrayOfElements); |
---|
| 29 | Vector3 separation(NPC** arrayOfElements); |
---|
| 30 | Vector3 alignment(NPC** arrayOfElements); |
---|
| 31 | Vector3 cohesion(NPC** arrayOfElements); |
---|
| 32 | |
---|
| 33 | |
---|
| 34 | private: |
---|
| 35 | 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 |
---|
| 36 | |
---|
| 37 | // those values should maybe be controlled by a higher power and should maybe be parameters that can be changed |
---|
| 38 | static int const SEPERATIONDISTANCE = 300; //detectionradius of seperation |
---|
| 39 | static int const ALIGNMENTDISTANCE = 300; //detectionradius of alignment |
---|
| 40 | static int const COHESIONDISTANCE = 5000; //detectionradius of cohesion |
---|
| 41 | static int const ANZELEMENTS = 9; //number of elements |
---|
[603] | 42 | }; |
---|
| 43 | |
---|
| 44 | } |
---|
| 45 | #endif |
---|
Note: See
TracBrowser
for help on using the repository browser.