Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Nov 27, 2009, 1:11:53 PM (15 years ago)
Author:
wirthmi
Message:

Working permanent acceleration.

Location:
code/branches/presentation2/src/orxonox/controllers
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/branches/presentation2/src/orxonox/controllers/NewHumanController.cc

    r6157 r6173  
    107107
    108108            if ( this->acceleration_ > 0 )
    109                 HumanController::moveFrontBack(Vector2(clamp(this->acceleration_ + this->currentAcceleration_, 0.0f, 1.0f), 0));
     109            {
     110/*
     111if (this->controllableEntity_ && this->controllableEntity_->getEngine()) {
     112    std::cout << this->controllableEntity_->getEngine()->getAccelerationFront() << endl;
     113}
     114*/
     115                if ( this->accelerating_ )
     116                    HumanController::moveFrontBack(Vector2(1, 0));
     117                else
     118                    HumanController::moveFrontBack(Vector2(this->acceleration_, 0));
     119                this->accelerating_ = false;
     120                //HumanController::moveFrontBack(Vector2(clamp(this->acceleration_ + this->currentAcceleration_, 0.0f, 1.0f), 0));
     121            }
    110122        }
    111123
     
    239251    void NewHumanController::frontback(const Vector2& value)
    240252    {
    241         this->currentAcceleration_ = value.x;
    242 
    243         if (this->acceleration_ == 0)
     253        this->accelerating_ = true;
     254
     255        //if (this->acceleration_ == 0)
    244256            HumanController::frontback(value);
    245257    }
     
    285297        if ( NewHumanController::localController_s )
    286298        {
    287             NewHumanController::localController_s->acceleration_ += 0.08;
    288             NewHumanController::localController_s->acceleration_ = clamp(NewHumanController::localController_s->acceleration_ + 0.08f, 0.0f, 1.0f);
     299            NewHumanController::localController_s->acceleration_ = clamp(NewHumanController::localController_s->acceleration_ + 0.2f, 0.00f, 1.0f);
    289300        }
    290301    }
     
    294305        if ( NewHumanController::localController_s )
    295306        {
    296             NewHumanController::localController_s->acceleration_ = clamp(NewHumanController::localController_s->acceleration_ - 0.05f, 0.0f, 1.0f);
     307            NewHumanController::localController_s->acceleration_ = clamp(NewHumanController::localController_s->acceleration_ - 0.1f, 0.0f, 1.0f);
    297308        }
    298309    }
  • code/branches/presentation2/src/orxonox/controllers/NewHumanController.h

    r6149 r6173  
    7070            OrxonoxOverlay*             crossHairOverlay_;
    7171            float                       overlaySize_;
    72             float                       currentAcceleration_;
     72            bool                        accelerating_;
    7373            float                       acceleration_;
    7474            ClassTreeMask               targetMask_;
Note: See TracChangeset for help on using the changeset viewer.