Last change
on this file since 637 was
627,
checked in by bknecht, 17 years ago
|
working AI added (put them aside if you want)
|
File size:
1.2 KB
|
Line | |
---|
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 "Model.h" |
---|
12 | |
---|
13 | namespace orxonox { |
---|
14 | |
---|
15 | class NPC : public Model |
---|
16 | { |
---|
17 | public: |
---|
18 | |
---|
19 | NPC(); |
---|
20 | virtual ~NPC(); |
---|
21 | virtual void loadParams(TiXmlElement* xmlElem); |
---|
22 | void tick(float dt); |
---|
23 | void update(); |
---|
24 | void setValues(Vector3 location, Vector3 speed, Vector3 acceleration, bool movable); |
---|
25 | |
---|
26 | private: |
---|
27 | float getDistance(WorldEntity* temp); |
---|
28 | void calculateAcceleration(); |
---|
29 | Vector3 separation(); |
---|
30 | Vector3 alignment(); |
---|
31 | Vector3 cohesion(); |
---|
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 |
---|
42 | }; |
---|
43 | |
---|
44 | } |
---|
45 | #endif |
---|
Note: See
TracBrowser
for help on using the repository browser.