Changeset 8351 for code/trunk/src/orxonox/controllers
- Timestamp:
- Apr 28, 2011, 7:15:14 AM (14 years ago)
- Location:
- code/trunk/src/orxonox/controllers
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk/src/orxonox/controllers/ArtificialController.cc
r7801 r8351 847 847 Vector3 distanceCurrent = this->targetPosition_ - this->getControllableEntity()->getPosition(); 848 848 Vector3 distanceNew = it->getPosition() - this->getControllableEntity()->getPosition(); 849 if (!this->target_ || it->getPosition().squaredDistance(this->getControllableEntity()->getPosition()) * (1.5f + acos((this->getControllableEntity()->getOrientation() * WorldEntity::FRONT).dotProduct(distanceNew) / speed / distanceNew.length()) / (2 * math::pi))850 < this->targetPosition_.squaredDistance(this->getControllableEntity()->getPosition()) * (1.5f + acos((this->getControllableEntity()->getOrientation() * WorldEntity::FRONT).dotProduct(distanceCurrent) / speed / distanceCurrent.length()) / (2 * math::pi)) + rnd(-250, 250))849 if (!this->target_ || it->getPosition().squaredDistance(this->getControllableEntity()->getPosition()) * (1.5f + acos((this->getControllableEntity()->getOrientation() * WorldEntity::FRONT).dotProduct(distanceNew) / speed / distanceNew.length()) / math::twoPi) 850 < this->targetPosition_.squaredDistance(this->getControllableEntity()->getPosition()) * (1.5f + acos((this->getControllableEntity()->getOrientation() * WorldEntity::FRONT).dotProduct(distanceCurrent) / speed / distanceCurrent.length()) / math::twoPi) + rnd(-250, 250)) 851 851 { 852 852 this->target_ = (*it); -
code/trunk/src/orxonox/controllers/NewHumanController.cc
r8316 r8351 544 544 if (distance > 0.04f && distance <= 0.59f * arrowsSize_ / 2.0f ) 545 545 { 546 this->arrowsOverlay1_->setRotation(Degree(-90 + -1.0f * atan2(static_cast<float>(this->currentPitch_)/2*-1, static_cast<float>(this->currentYaw_)/2*-1) / (2.0f * math::pi)* 360.0f));546 this->arrowsOverlay1_->setRotation(Degree(-90 + -1.0f * atan2(static_cast<float>(this->currentPitch_)/2*-1, static_cast<float>(this->currentYaw_)/2*-1) / math::twoPi * 360.0f)); 547 547 this->arrowsOverlay1_->show(); 548 548 } 549 549 else if (distance > 0.59f * arrowsSize_ / 2.0f && distance <= 0.77f * arrowsSize_ / 2.0f ) 550 550 { 551 this->arrowsOverlay2_->setRotation(Degree(-90 + -1.0f * atan2(static_cast<float>(this->currentPitch_)/2*-1, static_cast<float>(this->currentYaw_)/2*-1) / (2.0f * math::pi)* 360.0f));551 this->arrowsOverlay2_->setRotation(Degree(-90 + -1.0f * atan2(static_cast<float>(this->currentPitch_)/2*-1, static_cast<float>(this->currentYaw_)/2*-1) / math::twoPi * 360.0f)); 552 552 this->arrowsOverlay2_->show(); 553 553 } 554 554 else if (distance > 0.77f * arrowsSize_ / 2.0f && distance <= arrowsSize_ / 2.0f) 555 555 { 556 this->arrowsOverlay3_->setRotation(Degree(-90 + -1.0f * atan2(static_cast<float>(this->currentPitch_)/2*-1, static_cast<float>(this->currentYaw_)/2*-1) / (2.0f * math::pi)* 360.0f));556 this->arrowsOverlay3_->setRotation(Degree(-90 + -1.0f * atan2(static_cast<float>(this->currentPitch_)/2*-1, static_cast<float>(this->currentYaw_)/2*-1) / math::twoPi * 360.0f)); 557 557 this->arrowsOverlay3_->show(); 558 558 } 559 559 else if (distance > arrowsSize_ / 2.0f) 560 560 { 561 this->arrowsOverlay4_->setRotation(Degree(-90 + -1.0f * atan2(static_cast<float>(this->currentPitch_)/2*-1, static_cast<float>(this->currentYaw_)/2*-1) / (2.0f * math::pi)* 360.0f));561 this->arrowsOverlay4_->setRotation(Degree(-90 + -1.0f * atan2(static_cast<float>(this->currentPitch_)/2*-1, static_cast<float>(this->currentYaw_)/2*-1) / math::twoPi * 360.0f)); 562 562 this->arrowsOverlay4_->show(); 563 563 }
Note: See TracChangeset
for help on using the changeset viewer.