Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jul 21, 2011, 5:36:37 PM (13 years ago)
Author:
jo
Message:

Moved intern waypoint functionallity from the waypointController to its base class ArtificialController. Further usage of this is planned.

File:
1 edited

Legend:

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

    r8766 r8769  
    212212        float random;
    213213        float maxrand = 100.0f / ACTION_INTERVAL;
     214        if (this->waypoints_.size() > 0 && this->getControllableEntity() && this->mode_ == DEFAULT) //Waypoint functionality.
     215        {
     216            if (this->waypoints_[this->currentWaypoint_]->getWorldPosition().squaredDistance(this->getControllableEntity()->getPosition()) <= this->squaredaccuracy_)
     217                this->currentWaypoint_ = (this->currentWaypoint_ + 1) % this->waypoints_.size();
     218
     219            this->moveToPosition(this->waypoints_[this->currentWaypoint_]->getWorldPosition());
     220        }
    214221        if(this->mode_ == DEFAULT)
    215222            {
Note: See TracChangeset for help on using the changeset viewer.