Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 9054


Ignore:
Timestamp:
Mar 23, 2012, 4:02:52 PM (12 years ago)
Author:
scmoritz
Message:

kein Zittern mehr, vereinzelte ungeplante Richtungsaenderungen

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/waypoints/src/orxonox/controllers/FormationController.cc

    r9043 r9054  
    274274        Vector2 coord = get2DViewcoordinates(this->getControllableEntity()->getPosition(), this->getControllableEntity()->getOrientation() * WorldEntity::FRONT, this->getControllableEntity()->getOrientation() * WorldEntity::UP, target);
    275275        float distance = (target - this->getControllableEntity()->getPosition()).length();
    276                 if(coord.x < 0.01 && coord.y < 0.01)
     276                if(coord.x < 0.0001 && coord.y < 0.0001)
    277277                {
    278                         // I AM HERE
    279                         //this->getControllableEntity()->setOrientation() 
     278                        // I AM HERE
     279                        Vector3 v_temp = this->getControllableEntity()->getPosition() * target;
     280                        Quaternion quat = v_temp.getRotationTo(target);
     281                        this->getControllableEntity()->rotate(quat);
     282                       
     283                        //this->getControllableEntity()->setOrientation(this->getControllableEntity()->getPosition().getRotationTo(target) * this->getControllableEntity()->getOrientation());
    280284                }
    281285
     
    285289            {
    286290                // Multiply with ROTATEFACTOR_FREE to make them a bit slower
    287                 this->getControllableEntity()->rotateYaw(-1.0f * ROTATEFACTOR_FREE * sgn(coord.x) * coord.x);
    288                 this->getControllableEntity()->rotatePitch(ROTATEFACTOR_FREE * sgn(coord.y) * coord.y);
     291                this->getControllableEntity()->rotateYaw(-1.0f * ROTATEFACTOR_FREE * coord.x * 2);
     292                this->getControllableEntity()->rotatePitch(ROTATEFACTOR_FREE * coord.y * 2);
    289293            }
    290294
     
    301305            if (this->target_ || distance > 10)
    302306            {
    303                 this->getControllableEntity()->rotateYaw(-1.0f * ROTATEFACTOR_MASTER * sgn(coord.x) * coord.x*coord.x);
    304                 this->getControllableEntity()->rotatePitch(ROTATEFACTOR_MASTER * sgn(coord.y) * coord.y*coord.y);
     307                this->getControllableEntity()->rotateYaw(-1.0f * ROTATEFACTOR_MASTER * coord.x * 2);
     308                this->getControllableEntity()->rotatePitch(ROTATEFACTOR_MASTER * coord.y * 2);
    305309            }
    306310
     
    316320        {
    317321
    318            this->getControllableEntity()->rotateYaw(-2.0f * ROTATEFACTOR_MASTER * sgn(coord.x) * coord.x*coord.x);
    319            this->getControllableEntity()->rotatePitch(2.0f * ROTATEFACTOR_MASTER * sgn(coord.y) * coord.y*coord.y);
     322           this->getControllableEntity()->rotateYaw(-2.0f * ROTATEFACTOR_MASTER * coord.x * 2);
     323           this->getControllableEntity()->rotatePitch(2.0f * ROTATEFACTOR_MASTER * coord.y * 2);
    320324
    321325            if (distance < 300)
Note: See TracChangeset for help on using the changeset viewer.