Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Nov 12, 2015, 9:30:14 AM (8 years ago)
Author:
gania
Message:

Sometimes there are too many rotations

File:
1 edited

Legend:

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

    r10793 r10796  
    7777            executingMoveToPoint_ = !this->moveAndRoll(dt);
    7878        }
     79        else
     80        {
     81            if (this->target_)
     82            {
     83                this->positionOfTarget_ = getPredictedPosition(
     84                    this->getControllableEntity()->getWorldPosition(),
     85                    hardcoded_projectile_speed,
     86                    this->target_->getWorldPosition(),
     87                    this->target_->getVelocity()
     88                    );
     89                Vector3 diffVector = this->positionOfTarget_ - this->getControllableEntity()->getWorldPosition();
     90                float diffLength = diffVector.length();
     91               /* Quaternion rotationToTarget = (this->getControllableEntity()->getOrientation() * WorldEntity::FRONT).getRotationTo(diffVector);
     92                Vector3* targetPosition = new Vector3 ( 0, 0, -200 );
     93                Vector3 target = rotationToTarget * (*targetPosition);*/
     94                if (diffLength > 200)
     95                    this->setTargetPosition( this->positionOfTarget_ - 0.6f*diffVector);
     96               
     97                else
     98                    this->setTargetPosition( this->getControllableEntity()->getWorldPosition() );
     99                executingMoveToPoint_ = true; 
     100            }
     101           
     102           
     103            if (this->maneuverType_ == ManeuverType::OFFENSIVE)
     104            {
     105                this->attack();
     106                this->moveAndRoll(dt);
     107            }
     108        }
    79109        if (this->bShooting_)
    80110            doFire();
     
    104134            }
    105135        }*/
    106         this->chooseManeuverType();
     136        //this->chooseManeuverType();
    107137        switch (this->maneuverType_)
    108138        {
     
    113143                break;
    114144            }
    115             case ManeuverType::DEFENSIVE:
     145            case ManeuverType::DEFENCIVE:
    116146            {
    117147                this->gunsD();
     148                break;
    118149            }
    119150            case ManeuverType::OFFENSIVE:
    120151            {
    121152                this->attack();
     153                break;
     154            }
     155            case ManeuverType::NEUTRAL:
     156            {
     157                this->scissors();
     158            }
     159            default:
     160            {
     161                this->gunsD();
     162                break;
    122163            }
    123164        }
    124165       
    125         if (!executingMoveToPoint_)
     166        /*if (!executingMoveToPoint_)
    126167        {
    127168            Vector3* targetPosition = new Vector3 (0, 0, -2000);
     
    129170            executingMoveToPoint_ = true;
    130171        }
    131        
     172        */
    132173        if (this->myFollower_ && this->target_)
    133174            this->myFollower_->setTarget(this->target_);
Note: See TracChangeset for help on using the changeset viewer.