Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
May 30, 2010, 3:57:05 PM (14 years ago)
Author:
gnadler
Message:

documentation & formatting commit

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/presentation3/src/modules/weapons/RocketController.cc

    r7018 r7021  
    5050        this->rocket_->setController(this);
    5151        this->setControllableEntity(dynamic_cast<ControllableEntity*> (this->rocket_));
    52         this->counter_=0;
    5352    }
    5453
     
    6261    void RocketController::tick(float dt)
    6362    {
    64         counter_++;
    6563
    6664        if (this->target_ && this->rocket_->hasFuel()) {
     
    9997        if (!this->getControllableEntity())
    10098            return;
    101         Vector2 coord = get2DViewdirection(this->getControllableEntity()->getPosition(), this->getControllableEntity()->getOrientation() * WorldEntity::FRONT, this->getControllableEntity()->getOrientation() * WorldEntity::UP, target);
    102         float distance = (target - this->getControllableEntity()->getWorldPosition()).length();
     99
     100        Vector2 coord = get2DViewdirection(this->rocket_->getPosition(), this->rocket_->getOrientation() * WorldEntity::FRONT, this->rocket_->getOrientation() * WorldEntity::UP, target);
     101        float distance = (target - this->rocket_->getWorldPosition()).length();
    103102
    104103
    105         if (distance > 1000&&this->getControllableEntity()->getVelocity().squaredLength()<160000)
    106             this->getControllableEntity()->setAcceleration(this->rocket_->getOrientation()*Vector3(-20,-20,-20));
     104        if (distance > 1000 && this->rocket_->getVelocity().squaredLength()<160000)
     105            this->rocket_->setAcceleration(this->rocket_->getOrientation()*Vector3(-20,-20,-20));
    107106        if (distance <1000) this->rocket_->setAcceleration(0,0,0);
    108        
    109         this->getControllableEntity()->rotateYaw(-sgn(coord.x)*coord.x*coord.x);
    110         this->getControllableEntity()->rotatePitch(sgn(coord.y)*coord.y*coord.y);
     107
     108        this->rocket_->rotateYaw(-sgn(coord.x)*coord.x*coord.x);
     109        this->rocket_->rotatePitch(sgn(coord.y)*coord.y*coord.y);
    111110    }
    112111
Note: See TracChangeset for help on using the changeset viewer.