Last change
on this file since 667 was
627,
checked in by bknecht, 17 years ago
|
working AI added (put them aside if you want)
|
File size:
1.2 KB
|
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 |
---|
[617] | 11 | #include "Model.h" |
---|
[603] | 12 | |
---|
| 13 | namespace orxonox { |
---|
| 14 | |
---|
[617] | 15 | class NPC : public Model |
---|
[603] | 16 | { |
---|
[617] | 17 | public: |
---|
| 18 | |
---|
| 19 | NPC(); |
---|
| 20 | virtual ~NPC(); |
---|
[627] | 21 | virtual void loadParams(TiXmlElement* xmlElem); |
---|
[617] | 22 | void tick(float dt); |
---|
[619] | 23 | void update(); |
---|
[617] | 24 | void setValues(Vector3 location, Vector3 speed, Vector3 acceleration, bool movable); |
---|
| 25 | |
---|
| 26 | private: |
---|
[627] | 27 | float getDistance(WorldEntity* temp); |
---|
| 28 | void calculateAcceleration(); |
---|
| 29 | Vector3 separation(); |
---|
| 30 | Vector3 alignment(); |
---|
| 31 | Vector3 cohesion(); |
---|
[617] | 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.