Changeset 6502 for code/trunk/src/orxonox/controllers
- Timestamp:
- Mar 11, 2010, 11:34:20 AM (15 years ago)
- Location:
- code/trunk/src/orxonox/controllers
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk/src/orxonox/controllers/ArtificialController.cc
r6417 r6502 65 65 { 66 66 // Multiply with 0.8 to make them a bit slower 67 this->getControllableEntity()->rotateYaw(-0.8 * sgn(coord.x) * coord.x*coord.x);68 this->getControllableEntity()->rotatePitch(0.8 * sgn(coord.y) * coord.y*coord.y);67 this->getControllableEntity()->rotateYaw(-0.8f * sgn(coord.x) * coord.x*coord.x); 68 this->getControllableEntity()->rotatePitch(0.8f * sgn(coord.y) * coord.y*coord.y); 69 69 } 70 70 71 71 if (this->target_ && distance < 200 && this->getControllableEntity()->getVelocity().squaredLength() > this->target_->getVelocity().squaredLength()) 72 this->getControllableEntity()->moveFrontBack(-0.5 ); // They don't brake with full power to give the player a chance72 this->getControllableEntity()->moveFrontBack(-0.5f); // They don't brake with full power to give the player a chance 73 73 else 74 this->getControllableEntity()->moveFrontBack(0.8 );74 this->getControllableEntity()->moveFrontBack(0.8f); 75 75 } 76 76 -
code/trunk/src/orxonox/controllers/NewHumanController.cc
r6501 r6502 74 74 RegisterObject(NewHumanController); 75 75 76 overlaySize_ = 0.08 ;77 arrowsSize_ = 0.4 ;78 79 damageOverlayTime_ = 0.6 ;76 overlaySize_ = 0.08f; 77 arrowsSize_ = 0.4f; 78 79 damageOverlayTime_ = 0.6f; 80 80 81 81 controlMode_ = 0; … … 101 101 centerOverlay_ = new OrxonoxOverlay(this); 102 102 centerOverlay_->setBackgroundMaterial("Orxonox/CenterOverlay"); 103 centerOverlay_->setSize(Vector2(overlaySize_ * 2.5 , overlaySize_ * 2.5));104 centerOverlay_->setPosition(Vector2(0.5 - overlaySize_*2.5/2.0, 0.5 - overlaySize_*2.5/2.0));103 centerOverlay_->setSize(Vector2(overlaySize_ * 2.5f, overlaySize_ * 2.5f)); 104 centerOverlay_->setPosition(Vector2(0.5f - overlaySize_*2.5f/2.0f, 0.5f - overlaySize_*2.5f/2.0f)); 105 105 centerOverlay_->hide(); 106 106 … … 109 109 damageOverlayTop_ = new OrxonoxOverlay(this); 110 110 damageOverlayTop_->setBackgroundMaterial("Orxonox/DamageOverlayTop"); 111 damageOverlayTop_->setSize(Vector2(overlaySize_ * 2.5 , overlaySize_ * 2.5));112 damageOverlayTop_->setPosition(Vector2(0.5 - overlaySize_*2.5/2.0, 0.5 - overlaySize_*2.5/2.0));111 damageOverlayTop_->setSize(Vector2(overlaySize_ * 2.5f, overlaySize_ * 2.5f)); 112 damageOverlayTop_->setPosition(Vector2(0.5f - overlaySize_*2.5f/2.0f, 0.5f - overlaySize_*2.5f/2.0f)); 113 113 damageOverlayTop_->hide(); 114 114 115 115 damageOverlayRight_ = new OrxonoxOverlay(this); 116 116 damageOverlayRight_->setBackgroundMaterial("Orxonox/DamageOverlayRight"); 117 damageOverlayRight_->setSize(Vector2(overlaySize_ * 2.5 , overlaySize_ * 2.5));118 damageOverlayRight_->setPosition(Vector2(0.5 - overlaySize_*2.5/2.0, 0.5 - overlaySize_*2.5/2.0));117 damageOverlayRight_->setSize(Vector2(overlaySize_ * 2.5f, overlaySize_ * 2.5f)); 118 damageOverlayRight_->setPosition(Vector2(0.5f - overlaySize_*2.5f/2.0f, 0.5f - overlaySize_*2.5f/2.0f)); 119 119 damageOverlayRight_->hide(); 120 120 121 121 damageOverlayBottom_ = new OrxonoxOverlay(this); 122 122 damageOverlayBottom_->setBackgroundMaterial("Orxonox/DamageOverlayBottom"); 123 damageOverlayBottom_->setSize(Vector2(overlaySize_ * 2.5 , overlaySize_ * 2.5));124 damageOverlayBottom_->setPosition(Vector2(0.5 - overlaySize_*2.5/2.0, 0.5 - overlaySize_*2.5/2.0));123 damageOverlayBottom_->setSize(Vector2(overlaySize_ * 2.5f, overlaySize_ * 2.5f)); 124 damageOverlayBottom_->setPosition(Vector2(0.5f - overlaySize_*2.5f/2.0f, 0.5f - overlaySize_*2.5f/2.0f)); 125 125 damageOverlayBottom_->hide(); 126 126 127 127 damageOverlayLeft_ = new OrxonoxOverlay(this); 128 128 damageOverlayLeft_->setBackgroundMaterial("Orxonox/DamageOverlayLeft"); 129 damageOverlayLeft_->setSize(Vector2(overlaySize_ * 2.5 , overlaySize_ * 2.5));130 damageOverlayLeft_->setPosition(Vector2(0.5 - overlaySize_*2.5/2.0, 0.5 - overlaySize_*2.5/2.0));129 damageOverlayLeft_->setSize(Vector2(overlaySize_ * 2.5f, overlaySize_ * 2.5f)); 130 damageOverlayLeft_->setPosition(Vector2(0.5f - overlaySize_*2.5f/2.0f, 0.5f - overlaySize_*2.5f/2.0f)); 131 131 damageOverlayLeft_->hide(); 132 132 } … … 136 136 arrowsOverlay1_ = new OrxonoxOverlay(this); 137 137 arrowsOverlay1_->setBackgroundMaterial("Orxonox/DirectionArrows1"); 138 arrowsOverlay1_->setSize(Vector2(0.02727 , 0.36* arrowsSize_));139 arrowsOverlay1_->setPickPoint(Vector2(0.5 , 0.5));140 arrowsOverlay1_->setPosition(Vector2(0.5 , 0.5));138 arrowsOverlay1_->setSize(Vector2(0.02727f, 0.36f * arrowsSize_)); 139 arrowsOverlay1_->setPickPoint(Vector2(0.5f, 0.5f)); 140 arrowsOverlay1_->setPosition(Vector2(0.5f, 0.5f)); 141 141 arrowsOverlay1_->hide(); 142 142 143 143 arrowsOverlay2_ = new OrxonoxOverlay(this); 144 144 arrowsOverlay2_->setBackgroundMaterial("Orxonox/DirectionArrows2"); 145 arrowsOverlay2_->setSize(Vector2(0.02727 , 0.59* arrowsSize_));146 arrowsOverlay2_->setPickPoint(Vector2(0.5 , 0.5));147 arrowsOverlay2_->setPosition(Vector2(0.5 , 0.5));145 arrowsOverlay2_->setSize(Vector2(0.02727f, 0.59f * arrowsSize_)); 146 arrowsOverlay2_->setPickPoint(Vector2(0.5f, 0.5f)); 147 arrowsOverlay2_->setPosition(Vector2(0.5f, 0.5f)); 148 148 arrowsOverlay2_->hide(); 149 149 150 150 arrowsOverlay3_ = new OrxonoxOverlay(this); 151 151 arrowsOverlay3_->setBackgroundMaterial("Orxonox/DirectionArrows3"); 152 arrowsOverlay3_->setSize(Vector2(0.02727 , 0.77* arrowsSize_));153 arrowsOverlay3_->setPickPoint(Vector2(0.5 , 0.5));154 arrowsOverlay3_->setPosition(Vector2(0.5 , 0.5));152 arrowsOverlay3_->setSize(Vector2(0.02727f, 0.77f * arrowsSize_)); 153 arrowsOverlay3_->setPickPoint(Vector2(0.5f, 0.5f)); 154 arrowsOverlay3_->setPosition(Vector2(0.5f, 0.5f)); 155 155 arrowsOverlay3_->hide(); 156 156 157 157 arrowsOverlay4_ = new OrxonoxOverlay(this); 158 158 arrowsOverlay4_->setBackgroundMaterial("Orxonox/DirectionArrows4"); 159 arrowsOverlay4_->setSize(Vector2(0.02727 , arrowsSize_));160 arrowsOverlay4_->setPickPoint(Vector2(0.5 , 0.5));161 arrowsOverlay4_->setPosition(Vector2(0.5 , 0.5));159 arrowsOverlay4_->setSize(Vector2(0.02727f, arrowsSize_)); 160 arrowsOverlay4_->setPickPoint(Vector2(0.5f, 0.5f)); 161 arrowsOverlay4_->setPosition(Vector2(0.5f, 0.5f)); 162 162 arrowsOverlay4_->hide(); 163 163 } … … 213 213 this->showOverlays(); 214 214 215 this->crossHairOverlay_->setPosition(Vector2(static_cast<float>(this->currentYaw_)/2*-1+.5 -overlaySize_/2, static_cast<float>(this->currentPitch_)/2*-1+.5-overlaySize_/2));215 this->crossHairOverlay_->setPosition(Vector2(static_cast<float>(this->currentYaw_)/2*-1+.5f-overlaySize_/2, static_cast<float>(this->currentPitch_)/2*-1+.5f-overlaySize_/2)); 216 216 217 217 if (this->controlMode_ == 0 || (this->controlMode_ == 1 && this->firemode_ == 1)) … … 299 299 relativeHit.normalise(); 300 300 301 float threshold = 0.3 ;301 float threshold = 0.3f; 302 302 if (relativeHit.x > threshold) // Left 303 303 { … … 343 343 Ogre::RaySceneQuery * rsq = HumanController::localController_s->getControllableEntity()->getScene()->getSceneManager()->createRayQuery(Ogre::Ray()); 344 344 345 Ogre::Ray mouseRay = HumanController::localController_s->getControllableEntity()->getCamera()->getOgreCamera()->getCameraToViewportRay(static_cast<float>(this->currentYaw_)/2*-1+.5 , static_cast<float>(this->currentPitch_)/2*-1+.5);345 Ogre::Ray mouseRay = HumanController::localController_s->getControllableEntity()->getCamera()->getOgreCamera()->getCameraToViewportRay(static_cast<float>(this->currentYaw_)/2*-1+.5f, static_cast<float>(this->currentPitch_)/2*-1+.5f); 346 346 347 347 rsq->setRay(mouseRay); … … 505 505 float distance = sqrt(pow(static_cast<float>(this->currentYaw_)/2*-1,2) + pow(static_cast<float>(this->currentPitch_)/2*-1,2)); 506 506 507 if (distance > 0.04 && distance <= 0.59 * arrowsSize_ / 2.0)508 { 509 this->arrowsOverlay1_->setRotation(Degree(-90 + -1.0 * atan2(static_cast<float>(this->currentPitch_)/2*-1, static_cast<float>(this->currentYaw_)/2*-1) / (2.0f * Ogre::Math::PI) * 360.0f));507 if (distance > 0.04f && distance <= 0.59f * arrowsSize_ / 2.0f ) 508 { 509 this->arrowsOverlay1_->setRotation(Degree(-90 + -1.0f * atan2(static_cast<float>(this->currentPitch_)/2*-1, static_cast<float>(this->currentYaw_)/2*-1) / (2.0f * Ogre::Math::PI) * 360.0f)); 510 510 this->arrowsOverlay1_->show(); 511 511 } 512 else if (distance > 0.59 * arrowsSize_ / 2.0 && distance <= 0.77 * arrowsSize_ / 2.0)513 { 514 this->arrowsOverlay2_->setRotation(Degree(-90 + -1.0 * atan2(static_cast<float>(this->currentPitch_)/2*-1, static_cast<float>(this->currentYaw_)/2*-1) / (2.0f * Ogre::Math::PI) * 360.0f));512 else if (distance > 0.59f * arrowsSize_ / 2.0f && distance <= 0.77f * arrowsSize_ / 2.0f ) 513 { 514 this->arrowsOverlay2_->setRotation(Degree(-90 + -1.0f * atan2(static_cast<float>(this->currentPitch_)/2*-1, static_cast<float>(this->currentYaw_)/2*-1) / (2.0f * Ogre::Math::PI) * 360.0f)); 515 515 this->arrowsOverlay2_->show(); 516 516 } 517 else if (distance > 0.77 * arrowsSize_ / 2.0 && distance <= arrowsSize_ / 2.0)518 { 519 this->arrowsOverlay3_->setRotation(Degree(-90 + -1.0 * atan2(static_cast<float>(this->currentPitch_)/2*-1, static_cast<float>(this->currentYaw_)/2*-1) / (2.0f * Ogre::Math::PI) * 360.0f));517 else if (distance > 0.77f * arrowsSize_ / 2.0f && distance <= arrowsSize_ / 2.0f) 518 { 519 this->arrowsOverlay3_->setRotation(Degree(-90 + -1.0f * atan2(static_cast<float>(this->currentPitch_)/2*-1, static_cast<float>(this->currentYaw_)/2*-1) / (2.0f * Ogre::Math::PI) * 360.0f)); 520 520 this->arrowsOverlay3_->show(); 521 521 } 522 else if (distance > arrowsSize_ / 2.0 )523 { 524 this->arrowsOverlay4_->setRotation(Degree(-90 + -1.0 * atan2(static_cast<float>(this->currentPitch_)/2*-1, static_cast<float>(this->currentYaw_)/2*-1) / (2.0f * Ogre::Math::PI) * 360.0f));522 else if (distance > arrowsSize_ / 2.0f) 523 { 524 this->arrowsOverlay4_->setRotation(Degree(-90 + -1.0f * atan2(static_cast<float>(this->currentPitch_)/2*-1, static_cast<float>(this->currentYaw_)/2*-1) / (2.0f * Ogre::Math::PI) * 360.0f)); 525 525 this->arrowsOverlay4_->show(); 526 526 } -
code/trunk/src/orxonox/controllers/WaypointPatrolController.cc
r5929 r6502 68 68 this->moveToTargetPosition(); 69 69 70 if (this->getControllableEntity() && this->isCloseAtTarget(1000) && this->isLookingAtTarget(Ogre::Math::PI / 20.0 ))70 if (this->getControllableEntity() && this->isCloseAtTarget(1000) && this->isLookingAtTarget(Ogre::Math::PI / 20.0f)) 71 71 this->getControllableEntity()->fire(0); 72 72 } … … 85 85 86 86 Vector3 myposition = this->getControllableEntity()->getPosition(); 87 float shortestsqdistance = static_cast<unsigned int>(-1);87 float shortestsqdistance = (float)static_cast<unsigned int>(-1); 88 88 89 89 for (ObjectList<Pawn>::iterator it = ObjectList<Pawn>::begin(); it != ObjectList<Pawn>::end(); ++it)
Note: See TracChangeset
for help on using the changeset viewer.