Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Oct 19, 2015, 5:15:17 PM (9 years ago)
Author:
gania
Message:

added setDesiredPositionOfSlaves() to FormationController, Vector3* desiredRelativePosition_ as a member var to FormationController, added a "stay in formation" functionality to tick of AIController. TODO change from moveToPosition to a Waypoint. Remark: create a WorldEntity object at certain position

File:
1 edited

Legend:

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

    r10670 r10673  
    205205        float maxrand = 100.0f / ACTION_INTERVAL;
    206206        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         
    215220        }
    216221        //DOES: Either move to the waypoint or search for a Point of interest
Note: See TracChangeset for help on using the changeset viewer.