Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 10875


Ignore:
Timestamp:
Nov 27, 2015, 1:41:26 PM (8 years ago)
Author:
gania
Message:

fixed library dependencies

Location:
code/branches/campaignHS15
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • code/branches/campaignHS15/data/levels/AITest.oxw

    r10872 r10875  
    6262<!-- HERE STARTS DEMO FOR THE ACTIONPOINTS.
    6363P.S. Never set protectMe in the first actionpoint: if human didn't spawn, that actionpoint will be skipped -->
    64        <!--
     64       
    6565    <Model mesh="cube.mesh" scale=8 position="0,0,0" />
    6666
     
    124124    </SpaceShip>
    125125 
    126     -->
     126   
    127127<!-- HERE ENDS DEMO FOR THE ACTIONPOINTS -->
    128128<!-- HERE STARTS DEMO FOR FIGHTING -->
     
    210210<!-- HERE ENDS DEMO FOR FIGHTING -->
    211211<!-- HERE STARTS DEMO FOR FORMATIONS -->
    212    
     212    <!--
    213213    <Model mesh="cube.mesh" scale=8 position="   0,2000,    0" />
    214214    <Model mesh="cube.mesh" scale=8 position="   0,2000,-2000" />
     
    259259      </controller>
    260260    </SpaceShip>
    261    
     261    -->
    262262<!-- HERE ENDS DEMO FOR FORMATIONS -->
    263263   
  • code/branches/campaignHS15/src/orxonox/controllers/ActionpointController.cc

    r10872 r10875  
    3030
    3131#include "core/XMLPort.h"
    32 
    33 #include "controllers/NewHumanController.h"
     32#include <algorithm>
     33
    3434
    3535namespace orxonox
     
    295295                    for (ObjectList<Pawn>::iterator itP = ObjectList<Pawn>::begin(); itP; ++itP)
    296296                    {
    297                         if (orxonox_cast<ControllableEntity*>(*itP) && ((*itP)->getController()) && orxonox_cast <NewHumanController*> ((*itP)->getController()))
     297                        if (orxonox_cast<ControllableEntity*>(*itP) && ((*itP)->getController()) && ((*itP)->getController()->getIdentifier()->getName() == "NewHumanController"))
    298298                        {
    299299                            this->setProtect (static_cast<ControllableEntity*>(*itP));
  • code/branches/campaignHS15/src/orxonox/controllers/CommonController.cc

    r10871 r10875  
    3838#include "controllers/NewHumanController.h"
    3939#include "controllers/DroneController.h"
     40#include "util/Math.h"
    4041
    4142namespace orxonox
  • code/branches/campaignHS15/src/orxonox/controllers/CommonController.h

    r10871 r10875  
    3434#include "worldentities/ControllableEntity.h"
    3535#include "worldentities/pawns/Pawn.h"
    36 #include "util/Math.h"
    3736
    3837#include "tools/Timer.h"
    3938#include "tools/interfaces/Tickable.h"
    4039#include <limits>
    41 #include <algorithm>
    4240#include "worldentities/Actionpoint.h"
    43 #include "worldentities/pawns/SpaceShip.h"
    4441
    4542namespace orxonox
  • code/branches/campaignHS15/src/orxonox/controllers/FightingController.cc

    r10871 r10875  
    2828#include "controllers/FightingController.h"
    2929#include "core/XMLPort.h"
    30 #include <limits>                                                               //for finding closest target
     30#include "util/Math.h"
    3131
    3232
  • code/branches/campaignHS15/src/orxonox/controllers/FlyingController.cc

    r10871 r10875  
    2929#include "core/XMLPort.h"
    3030#include "worldentities/pawns/SpaceShip.h"
     31#include "util/Math.h"
    3132
    3233namespace orxonox
     
    128129    void FlyingController::copyOrientation( const Quaternion& orient, float dt )
    129130    {
    130         //roll angle difference in radian
    131         float diff=orient.getRoll(false).valueRadians() -
     131
     132        double diff=orient.getRoll(false).valueRadians() -
    132133                        ( this->getControllableEntity() ->getOrientation() .getRoll( false ).valueRadians() );
    133         while( diff>math::twoPi )diff-=math::twoPi;
     134        while( diff>math::twoPi)diff-=math::twoPi;
    134135        while( diff<-math::twoPi )diff+=math::twoPi;
    135         this->getControllableEntity() ->rotateRoll( diff*0.2f*ROTATEFACTOR * dt );
     136
     137        this->getControllableEntity() ->rotateRoll(diff * ROTATEFACTOR * dt);
    136138    }
     139    //change log: increased precision, increased rotation speed
    137140    void FlyingController::copyTargetOrientation( float dt )
    138141    {
  • code/branches/campaignHS15/src/orxonox/controllers/FlyingController.h

    r10871 r10875  
    3636{   
    3737    const float SPEED = 0.9f/0.02f;
    38     const float ROTATEFACTOR = 1.0f/0.02f;
     38    const float ROTATEFACTOR = 0.6f/0.02f;
    3939    namespace FormationMode
    4040    {
  • code/branches/campaignHS15/src/orxonox/controllers/SectionController.cc

    r10873 r10875  
    7878        if (!this->isActive())
    7979            return;
    80      
    81        
     80
     81    //this doesn't fight in formation flight, thus we can afford executing following code in tick: when nobody fights, tick is anyway stable.
     82        if (this->myDivisionLeader_ && this->myDivisionLeader_->getAction() != Action::FIGHT && this->myDivisionLeader_->getAction() !=
     83            Action::FIGHTALL && this->myDivisionLeader_->getAction() != Action::ATTACK)
     84        {
     85            ControllableEntity* myEntity = this->getControllableEntity();
     86            Vector3 myPosition = myEntity->getWorldPosition();
     87            if (!this->myDivisionLeader_)
     88            {
     89                return;
     90            }
     91            ControllableEntity* leaderEntity = this->myDivisionLeader_->getControllableEntity();
     92            Quaternion orient = leaderEntity->getWorldOrientation();
     93            Vector3 leaderPosition = leaderEntity->getWorldPosition();
     94
     95            Vector3 targetRelativePosition = getFormationPosition();
     96            if (!this->myDivisionLeader_)
     97            {
     98                return;
     99            }
     100            Vector3 targetAbsolutePosition =
     101                (leaderPosition + (orient*WorldEntity::FRONT) * (leaderEntity->getVelocity().length()/5)
     102                 + (orient* (targetRelativePosition)));
     103       
     104            this->setAction (Action::FLY, targetAbsolutePosition, orient);
     105            if ((targetAbsolutePosition - myPosition).length() > this->tolerance_ * 1.5f)
     106            {
     107                this->boostControl();
     108            }
     109            else
     110            {
     111               this->getControllableEntity()->boost(false);
     112            }
     113        }   
    82114        SUPER(SectionController, tick, dt);
    83115    }
     
    143175                default:
    144176                {
    145                     ControllableEntity* myEntity = this->getControllableEntity();
    146                     Vector3 myPosition = myEntity->getWorldPosition();
    147                     if (!this->myDivisionLeader_)
    148                     {
    149                         return;
    150                     }
    151                     ControllableEntity* leaderEntity = this->myDivisionLeader_->getControllableEntity();
    152                     Quaternion orient = leaderEntity->getWorldOrientation();
    153                     Vector3 leaderPosition = leaderEntity->getWorldPosition();
    154 
    155                     Vector3 targetRelativePosition = getFormationPosition();
    156                     if (!this->myDivisionLeader_)
    157                     {
    158                         return;
    159                     }
    160                     Vector3 targetAbsolutePosition =
    161                         (leaderPosition + (orient*WorldEntity::FRONT) * (leaderEntity->getVelocity().length()/5)
    162                          + (orient* (targetRelativePosition)));
    163                
    164                     this->setAction (Action::FLY, targetAbsolutePosition, orient);
    165                     if ((targetAbsolutePosition - myPosition).length() > this->tolerance_ * 1.5f)
    166                     {
    167                         this->boostControl();
    168                     }
    169                     else
    170                     {
    171                        this->getControllableEntity()->boost(false);
    172                     }
     177                    //formation flight is executed in tick
    173178                }
    174179            }
  • code/branches/campaignHS15/src/orxonox/controllers/WingmanController.cc

    r10873 r10875  
    6868        if (!this->isActive())
    6969            return;
    70        
     70        if (this->myLeader_ && this->myLeader_->getAction() != Action::FIGHT && this->myLeader_->getAction() !=
     71            Action::FIGHTALL && this->myLeader_->getAction() != Action::ATTACK)
     72        {
     73            ControllableEntity* myEntity = this->getControllableEntity();
     74            Vector3 myPosition = myEntity->getWorldPosition();
     75            if (!this->myLeader_)
     76            {
     77                return;
     78            }
     79            ControllableEntity* leaderEntity = this->myLeader_->getControllableEntity();
     80            Quaternion orient = leaderEntity->getWorldOrientation();
     81            Vector3 leaderPosition = leaderEntity->getWorldPosition();
     82
     83            Vector3 targetRelativePosition = getFormationPosition();
     84            if (!this->myLeader_)
     85            {
     86                return;
     87            }
     88            Vector3 targetAbsolutePosition =
     89                (leaderPosition + (orient*WorldEntity::FRONT) * (leaderEntity->getVelocity().length()/5)
     90                 + (orient* (targetRelativePosition)));
     91       
     92            this->setAction (Action::FLY, targetAbsolutePosition, orient);
     93            if ((targetAbsolutePosition - myPosition).length() > this->tolerance_ * 1.5f)
     94            {
     95                this->boostControl();
     96            }
     97            else
     98            {
     99               this->getControllableEntity()->boost(false);
     100            }
     101        }   
    71102       
    72103        SUPER(WingmanController, tick, dt);
     
    123154                default:
    124155                {
    125                     ControllableEntity* myEntity = this->getControllableEntity();
    126                     Vector3 myPosition = myEntity->getWorldPosition();
    127                     if (!this->myLeader_)
    128                     {
    129                         return;
    130                     }
    131156                   
    132                     ControllableEntity* leaderEntity = this->myLeader_->getControllableEntity();
    133                     Quaternion orient = leaderEntity->getWorldOrientation();
    134                     Vector3 leaderPosition = leaderEntity->getWorldPosition();
    135 
    136                     Vector3 targetRelativePosition = getFormationPosition();
    137                     if (!this->myLeader_)
    138                     {
    139                         return;
    140                     }
    141                     Vector3 targetAbsolutePosition =
    142                         (leaderPosition + (orient*WorldEntity::FRONT) * (leaderEntity->getVelocity().length()/5)
    143                          + (orient* (targetRelativePosition)));
    144                
    145                     this->setAction (Action::FLY, targetAbsolutePosition, orient);
    146                     if ((targetAbsolutePosition - myPosition).length() > this->tolerance_ * 1.5f)
    147                     {
    148                         this->boostControl();
    149                     }
    150                     else
    151                     {
    152                        this->getControllableEntity()->boost(false);
    153                     }
    154157                }
    155158            }
Note: See TracChangeset for help on using the changeset viewer.