Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Dec 17, 2008, 2:10:11 AM (15 years ago)
Author:
landauf
Message:

merged weapon2 branch to presentation

Location:
code/branches/presentation
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/branches/presentation

  • code/branches/presentation/src/orxonox/objects/controllers/ArtificialController.cc

    r2485 r2493  
    5656
    5757        Vector2 coord = get2DViewdirection(this->getControllableEntity()->getPosition(), this->getControllableEntity()->getOrientation() * WorldEntity::FRONT, this->getControllableEntity()->getOrientation() * WorldEntity::UP, this->targetPosition_);
     58        float distance = (this->targetPosition_ - this->getControllableEntity()->getPosition()).length();
    5859
    59         float distance = (this->targetPosition_ - this->getControllableEntity()->getPosition()).length();
    60         if (this->target_ || distance > 50)
     60        if (this->target_ || distance > 10)
    6161        {
    6262            // Multiply with 0.8 to make them a bit slower
    63             this->getControllableEntity()->rotateYaw(0.8 * sgn(coord.x) * coord.x*coord.x);
     63            this->getControllableEntity()->rotateYaw(-0.8 * sgn(coord.x) * coord.x*coord.x);
    6464            this->getControllableEntity()->rotatePitch(0.8 * sgn(coord.y) * coord.y*coord.y);
    6565        }
    6666
    67         if (this->target_ && distance < 1000 && this->getControllableEntity()->getVelocity().squaredLength() > this->target_->getVelocity().squaredLength())
     67        if (this->target_ && distance < 200 && this->getControllableEntity()->getVelocity().squaredLength() > this->target_->getVelocity().squaredLength())
    6868            this->getControllableEntity()->moveFrontBack(-0.5); // They don't brake with full power to give the player a chance
    6969        else
     
    7373    void ArtificialController::searchRandomTargetPosition()
    7474    {
    75         this->targetPosition_ = Vector3(rnd(-5000,5000), rnd(-5000,5000), rnd(-5000,5000));
     75        this->targetPosition_ = Vector3(rnd(-2000,2000), rnd(-2000,2000), rnd(-2000,2000));
    7676        this->bHasTargetPosition_ = true;
    7777    }
     
    8888        {
    8989//            if (it->getTeamNr() != this->getTeamNr())
     90            if ((ControllableEntity*)(*it) != this->getControllableEntity())
    9091            {
    9192                float speed = this->getControllableEntity()->getVelocity().length();
     
    113114            return;
    114115
    115         static const float hardcoded_projectile_speed = 500;
     116        static const float hardcoded_projectile_speed = 1250;
    116117
    117         this->targetPosition_ = getPredictedPosition(this->getControllableEntity()->getPosition(), hardcoded_projectile_speed, this->target_->getPosition(), this->target_->getOrientation() * this->target_->getVelocity());
     118        this->targetPosition_ = getPredictedPosition(this->getControllableEntity()->getPosition(), hardcoded_projectile_speed, this->target_->getPosition(), this->target_->getVelocity());
    118119        this->bHasTargetPosition_ = (this->targetPosition_ != Vector3::ZERO);
    119120    }
     
    138139    }
    139140
    140     void ArtificialController::shipDied(Pawn* ship)
     141    void ArtificialController::destroyedPawn(Pawn* ship)
    141142    {
    142143        if (ship == this->target_)
Note: See TracChangeset for help on using the changeset viewer.