Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Oct 29, 2015, 11:53:45 AM (9 years ago)
Author:
gania
Message:

Wingmen and Leaders look for their leaders

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/AI_HS15/src/orxonox/controllers/FormationController.cc

    r10678 r10717  
    105105                        orxout(internal_error) << this << " is still master in " << (*it) << endl;
    106106                        it->myMaster_ = 0;
    107                         it->state_ = FREE;
    108107                    }
    109108
     
    278277        }
    279278
    280         Vector2 coord = get2DViewCoordinates(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);
    281280        float distance = (target - this->getControllableEntity()->getPosition()).length();
    282281        float rotateX = clamp(coord.x * 10, -1.0f, 1.0f);
     
    473472        Vector3 dest = this->getControllableEntity()->getPosition();
    474473
    475         // only 1 slave: follow
     474        // 1 slave: follow
    476475        if (this->slaves_.size() == 1)
    477476        {
     
    703702        }
    704703    }
    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     }
    734704
    735705    /**
     
    10991069            return;
    11001070
    1101         Vector2 coord = get2DViewCoordinates(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);
    11021072        float distance = (target - this->getControllableEntity()->getPosition()).length();
    11031073
     
    11171087    }
    11181088
    1119     void FormationController::changedControllableEntity()
    1120     {
    1121         Controller::changedControllableEntity(); // super
    1122 
    1123         // when changing the controllable entity, ensure that the controller does not use the new entity as target
    1124         if (this->target_ && this->getControllableEntity() == static_cast<ControllableEntity*>(this->target_))
    1125             this->forgetTarget();
    1126     }
    11271089}
Note: See TracChangeset for help on using the changeset viewer.