- Timestamp:
- Oct 19, 2015, 4:01:54 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/AI_HS15/src/orxonox/controllers/FormationController.cc
r10652 r10670 278 278 } 279 279 280 Vector2 coord = get2DView coordinates(this->getControllableEntity()->getPosition(), this->getControllableEntity()->getOrientation() * WorldEntity::FRONT, this->getControllableEntity()->getOrientation() * WorldEntity::UP, target);280 Vector2 coord = get2DViewCoordinates(this->getControllableEntity()->getPosition(), this->getControllableEntity()->getOrientation() * WorldEntity::FRONT, this->getControllableEntity()->getOrientation() * WorldEntity::UP, target); 281 281 float distance = (target - this->getControllableEntity()->getPosition()).length(); 282 282 float rotateX = clamp(coord.x * 10, -1.0f, 1.0f); … … 703 703 } 704 704 } 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 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; 726 } 727 728 } 705 729 706 730 /** … … 1070 1094 return; 1071 1095 1072 Vector2 coord = get2DView coordinates(this->getControllableEntity()->getPosition(), this->getControllableEntity()->getOrientation() * WorldEntity::FRONT, this->getControllableEntity()->getOrientation() * WorldEntity::UP, target);1096 Vector2 coord = get2DViewCoordinates(this->getControllableEntity()->getPosition(), this->getControllableEntity()->getOrientation() * WorldEntity::FRONT, this->getControllableEntity()->getOrientation() * WorldEntity::UP, target); 1073 1097 float distance = (target - this->getControllableEntity()->getPosition()).length(); 1074 1098
Note: See TracChangeset
for help on using the changeset viewer.