- Timestamp:
- Nov 25, 2015, 6:46:20 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/campaignHS15/src/orxonox/controllers/CommonController.cc
r10856 r10859 63 63 CommonController::CommonController( Context* context ): Controller( context ) 64 64 { 65 this->squaredaccuracy_ = 10000;65 this->squaredaccuracy_ = 2500; 66 66 this->bFirstTick_ = true; 67 67 this->tolerance_ = 50; … … 71 71 this->bInLoop_ = false; 72 72 this->bLoop_ = false; 73 this->bEndLoop_ = false; 74 this->parsedActionpoints_.clear(); 73 75 RegisterObject( CommonController ); 76 74 77 } 75 78 CommonController::~CommonController() 76 79 { 77 78 80 } 79 81 void CommonController::tick(float dt) … … 161 163 Vector3 position; 162 164 std::string targetName; 163 bool inLoop ;165 bool inLoop = false; 164 166 Point p; 165 167 if (static_cast<Actionpoint*> (actionpoint)) … … 170 172 position = ap->getWorldPosition(); 171 173 172 if (!this->bInLoop_ && ap->getStartLoop()) 174 if (this->bEndLoop_) 175 { 176 this->bInLoop_ = false; 177 } 178 if (!this->bInLoop_ && ap->getLoopStart()) 173 179 { 174 180 this->bInLoop_ = true; 175 181 } 176 if (this->bInLoop_ && ap->get EndLoop())177 { 178 this->b InLoop_ = false;182 if (this->bInLoop_ && ap->getLoopEnd()) 183 { 184 this->bEndLoop_ = true; 179 185 } 180 186 inLoop = this->bInLoop_; … … 197 203 ThrowException( ParseError, std::string( "Attempting to set an unknown Action: '" )+ actionName + "'." ); 198 204 p.action = value; p.name = targetName; p.position = position; p.inLoop = inLoop; 199 parsedActionpoints_.push_back(p);200 205 } 201 206 else … … 519 524 while( diff>math::twoPi )diff-=math::twoPi; 520 525 while( diff<-math::twoPi )diff+=math::twoPi; 521 this->getControllableEntity() ->rotateRoll( diff* ROTATEFACTOR * dt );526 this->getControllableEntity() ->rotateRoll( diff*0.2f*ROTATEFACTOR * dt ); 522 527 } 523 528 void CommonController::copyTargetOrientation( float dt ) … … 975 980 void CommonController::nextActionpoint() 976 981 { 982 if (!this || !this->getControllableEntity()) 983 return; 977 984 if (this->bLoop_) 978 985 { … … 1019 1026 void CommonController::action() 1020 1027 { 1028 if (!this || !this->getControllableEntity()) 1029 return; 1030 orxout (internal_error) << "Size of actions is " << this->parsedActionpoints_.size() << endl; 1021 1031 this->startAttackingEnemiesThatAreClose(); 1022 1032 //No action -> pop one from stack … … 1126 1136 this->bLoop_ = b; 1127 1137 this->setAction (Action::NONE); 1128 this->setTarget(0);1129 this->setTargetPosition (this->getControllableEntity()->getWorldPosition());1138 // this->setTarget(0); 1139 // this->setTargetPosition (this->getControllableEntity()->getWorldPosition()); 1130 1140 orxout(internal_error) << "Top action is " << this->parsedActionpoints_.back().action << endl; 1131 1141 }
Note: See TracChangeset
for help on using the changeset viewer.