Changeset 10673 for code/branches/AI_HS15/src/orxonox/controllers
- Timestamp:
- Oct 19, 2015, 5:15:17 PM (9 years ago)
- Location:
- code/branches/AI_HS15/src/orxonox/controllers
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/AI_HS15/src/orxonox/controllers/AIController.cc
r10670 r10673 205 205 float maxrand = 100.0f / ACTION_INTERVAL; 206 206 ControllableEntity* controllable = this->getControllableEntity(); 207 if (this->state_ == SLAVE) 208 { 209 Vector3 desiredAbsolutePosition = this->myMaster_->getControllableEntity()->getWorldPosition() + this->myMaster_->getControllableEntity()->getWorldOrientation()*desiredRelativePosition_; 210 211 orxonox::WeakPtr<MovableEntity> waypoint = new MovableEntity(this->center_->getContext()); 212 waypoint->setPosition(desiredAbsolutePosition); 213 214 this->addWaypoint(waypoint); 207 if (this->state_ == SLAVE && controllable && this->mode_ == DEFAULT) 208 { 209 210 if (this->myMaster_ && this->myMaster_->getControllableEntity() && desiredRelativePosition_){ 211 Vector3 desiredAbsolutePosition = this->myMaster_->getControllableEntity()->getWorldPosition() + this->myMaster_->getControllableEntity()->getWorldOrientation()* (*desiredRelativePosition_); 212 this->moveToPosition (desiredAbsolutePosition); 213 //WorldEntity* waypoint = new WorldEntity(this->getContext()); 214 //waypoint->setPosition(desiredAbsolutePosition); 215 216 //this->addWaypoint(waypoint); 217 218 } 219 215 220 } 216 221 //DOES: Either move to the waypoint or search for a Point of interest -
code/branches/AI_HS15/src/orxonox/controllers/AIController.h
r10670 r10673 30 30 #define _AIController_H__ 31 31 32 #include "OrxonoxPrereqs.h" 32 #include "OrxonoxPrereqs.h" 33 33 34 #include "util/Math.h" 34 35 #include "tools/Timer.h" 35 36 #include "tools/interfaces/Tickable.h" 36 37 #include "ArtificialController.h" 38 37 39 38 40 namespace orxonox … … 55 57 Timer actionTimer_; //<! Regularly calls action(). 56 58 std::vector<WeakPtr<AIController> > enemies_, allies_; 57 Vector3* desiredRelativePosition_; 58 Vector3* currentRelativePosition_; 59 59 60 }; 60 61 } -
code/branches/AI_HS15/src/orxonox/controllers/FormationController.cc
r10670 r10673 712 712 switch (this->formationMode_){ 713 713 case ATTACK: 714 for(std::vector<FormationController*>::iterator it = slaves_.begin(), float i = 0; it != slaves_.end(); it++, ++i) 715 { 716 (*it)->desiredPosition_ = new Vector3 ((i-slaves_.size()/2)*200, 0, 0); 717 718 } 719 break; 720 case NORMAL: 721 722 break; 723 case DEFEND: 724 725 break; 714 { 715 float i = 0; 716 for(std::vector<FormationController*>::iterator it = slaves_.begin(); it != slaves_.end(); it++) 717 { 718 (*it)->desiredRelativePosition_ = new Vector3 ((i-slaves_.size()/2)*200, 0, 0); 719 i++; 720 } 721 break; 722 } 723 case NORMAL: 724 { 725 break; 726 } 727 case DEFEND: 728 { 729 break; 730 } 726 731 } 727 732 -
code/branches/AI_HS15/src/orxonox/controllers/FormationController.h
r10670 r10673 73 73 @brief If master, set the desired position of slaves (Vector2) for all the slaves. 74 74 */ 75 inlinevoid setDesiredPositionOfSlaves();76 75 void setDesiredPositionOfSlaves(); 76 77 77 inline void setPassive(bool passive) 78 78 { this->passive_ = passive; } … … 106 106 107 107 protected: 108 Vector3* desiredRelativePosition_; 108 109 bool formationFlight_; 109 110 bool passive_;
Note: See TracChangeset
for help on using the changeset viewer.