- Timestamp:
- Oct 29, 2015, 11:53:45 AM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/AI_HS15/src/orxonox/controllers/FormationController.cc
r10678 r10717 105 105 orxout(internal_error) << this << " is still master in " << (*it) << endl; 106 106 it->myMaster_ = 0; 107 it->state_ = FREE;108 107 } 109 108 … … 278 277 } 279 278 280 Vector2 coord = get2DView Coordinates(this->getControllableEntity()->getPosition(), this->getControllableEntity()->getOrientation() * WorldEntity::FRONT, this->getControllableEntity()->getOrientation() * WorldEntity::UP, target);279 Vector2 coord = get2DViewcoordinates(this->getControllableEntity()->getPosition(), this->getControllableEntity()->getOrientation() * WorldEntity::FRONT, this->getControllableEntity()->getOrientation() * WorldEntity::UP, target); 281 280 float distance = (target - this->getControllableEntity()->getPosition()).length(); 282 281 float rotateX = clamp(coord.x * 10, -1.0f, 1.0f); … … 473 472 Vector3 dest = this->getControllableEntity()->getPosition(); 474 473 475 // only1 slave: follow474 // 1 slave: follow 476 475 if (this->slaves_.size() == 1) 477 476 { … … 703 702 } 704 703 } 705 /**706 @brief If master, set the desired relative position of slaves (Vector3) in respect to a master for all the slaves.707 */708 void FormationController::setDesiredPositionOfSlaves()709 {710 if (this->state_ != MASTER)711 return;712 switch (this->formationMode_){713 case ATTACK: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 }731 }732 733 }734 704 735 705 /** … … 1099 1069 return; 1100 1070 1101 Vector2 coord = get2DView Coordinates(this->getControllableEntity()->getPosition(), this->getControllableEntity()->getOrientation() * WorldEntity::FRONT, this->getControllableEntity()->getOrientation() * WorldEntity::UP, target);1071 Vector2 coord = get2DViewcoordinates(this->getControllableEntity()->getPosition(), this->getControllableEntity()->getOrientation() * WorldEntity::FRONT, this->getControllableEntity()->getOrientation() * WorldEntity::UP, target); 1102 1072 float distance = (target - this->getControllableEntity()->getPosition()).length(); 1103 1073 … … 1117 1087 } 1118 1088 1119 void FormationController::changedControllableEntity()1120 {1121 Controller::changedControllableEntity(); // super1122 1123 // when changing the controllable entity, ensure that the controller does not use the new entity as target1124 if (this->target_ && this->getControllableEntity() == static_cast<ControllableEntity*>(this->target_))1125 this->forgetTarget();1126 }1127 1089 }
Note: See TracChangeset
for help on using the changeset viewer.