Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Oct 19, 2015, 4:01:54 PM (9 years ago)
Author:
gania
Message:

hold position in formation with waypoints

File:
1 edited

Legend:

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

    r10652 r10670  
    278278        }
    279279
    280         Vector2 coord = get2DViewcoordinates(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);
    281281        float distance = (target - this->getControllableEntity()->getPosition()).length();
    282282        float rotateX = clamp(coord.x * 10, -1.0f, 1.0f);
     
    703703        }
    704704    }
     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    }
    705729
    706730    /**
     
    10701094            return;
    10711095
    1072         Vector2 coord = get2DViewcoordinates(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);
    10731097        float distance = (target - this->getControllableEntity()->getPosition()).length();
    10741098
Note: See TracChangeset for help on using the changeset viewer.