Changeset 609 for code/branches/FICN/src/orxonox/Flocking.h
- Timestamp:
- Dec 18, 2007, 12:32:09 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/FICN/src/orxonox/Flocking.h
r596 r609 14 14 #endif 15 15 16 using namespace Ogre;17 16 18 17 class Element // An element that flocks … … 20 19 21 20 public: 22 Vector3 location; // locationvector of the element23 Vector3 speed; // speedvector of the element24 Vector3 acceleration; // accelerationvector of the element21 Ogre::Vector3 location; // locationvector of the element 22 Ogre::Vector3 speed; // speedvector of the element 23 Ogre::Vector3 acceleration; // accelerationvector of the element 25 24 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 26 25 static int const SEPERATIONDISTANCE = 300; //detectionradius of seperation … … 38 37 39 38 //constructor 40 Element( Vector3 location_, Vector3 speed_,Vector3 acceleration_, bool movable_) {39 Element(Ogre::Vector3 location_, Ogre::Vector3 speed_, Ogre::Vector3 acceleration_, bool movable_) { 41 40 acceleration = acceleration_; 42 41 speed = speed_; … … 46 45 47 46 //function to chance values of an element 48 void setValues( Vector3 location_, Vector3 speed_,Vector3 acceleration_, bool movable_) {47 void setValues(Ogre::Vector3 location_, Ogre::Vector3 speed_, Ogre::Vector3 acceleration_, bool movable_) { 49 48 acceleration = acceleration_; 50 49 speed = speed_; … … 55 54 //calculates the distance between the element and an other point given by temp 56 55 float getDistance(Element temp) { 57 Vector3 distance = temp.location-location;56 Ogre::Vector3 distance = temp.location-location; 58 57 return distance.length(); 59 58 } … … 70 69 71 70 //separation-function (keep elements separated, avoid crashs) 72 Vector3 separation(Element arrayOfElements[]) { 71 Ogre::Vector3 separation(Element arrayOfElements[]) { 72 using namespace Ogre; 73 73 Vector3 steering = Vector3(0,0,0); //steeringvector 74 74 Vector3 inverseDistance = Vector3(0,0,0); //vector pointing away from possible collisions … … 95 95 96 96 //alignment-function (lead elements to the same heading) 97 Vector3 alignment(Element arrayOfElements[]) { 97 Ogre::Vector3 alignment(Element arrayOfElements[]) { 98 using namespace Ogre; 98 99 Vector3 steering = Vector3(0,0,0); //steeringvector 99 100 int numberOfNeighbour = 0; //number of observed neighbours … … 113 114 114 115 //cohseion-function (keep elements close to each other) 115 Vector3 cohesion(Element arrayOfElements[]) { 116 Ogre::Vector3 cohesion(Element arrayOfElements[]) { 117 using namespace Ogre; 116 118 Vector3 steering = Vector3(0,0,0); //steeringvector 117 119 int numberOfNeighbour = 0; //number of observed neighbours
Note: See TracChangeset
for help on using the changeset viewer.