Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
May 21, 2010, 9:40:14 AM (14 years ago)
Author:
scheusso
Message:

steering of the rocket now working, but oscilating
control parameters need adjustment

File:
1 edited

Legend:

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

    r6943 r6950  
    8282        void RocketController::setTargetPosition() {
    8383                //this->targetPosition_=this->target_->getWorldPosition();
    84                 this->targetPosition_ = getPredictedPosition(this->getControllableEntity()->getPosition(),this->getControllableEntity()->getVelocity().length() , this->target_->getPosition(), this->target_->getVelocity());
     84                this->targetPosition_ = getPredictedPosition(this->getControllableEntity()->getWorldPosition(),this->getControllableEntity()->getVelocity().length() , this->target_->getWorldPosition(), this->target_->getVelocity());
    8585        }
    8686        void RocketController::moveToTargetPosition() {
     
    102102           float dy = target.y-this->getControllableEntity()->getPosition().y;
    103103           COUT(0)<<"\n diff: ";
    104            COUT(0)<<target.x-this->getControllableEntity()->getPosition().x;
    105            COUT(0)<<" ";
    106            COUT(0)<<target.y-this->getControllableEntity()->getPosition().y;
    107            COUT(0)<<" ";
    108            COUT(0)<<target.z-this->getControllableEntity()->getPosition().z;
     104           COUT(0)<<target-this->getControllableEntity()->getPosition() << endl;
    109105           //COUT(0)<<"\n 2D view: ";
    110106          /* COUT(0)<<this->getControllableEntity()->getPosition().x;
     
    117113        float distance = (target - this->getControllableEntity()->getPosition()).length();
    118114                //Vector3D diff =target-this->rocket->getPosition();
    119                 //COUT(0)<<coord.x;
     115                COUT(0) << "viewdirection: "<< coord << endl;
    120116                //COUT(0)<<"  ";
    121117                //COUT(0)<<coord.y;
    122                  this->getControllableEntity()->rotateYaw(coord.x*coord.x*coord.x*coord.x);
    123             this->getControllableEntity()->rotatePitch(coord.y*coord.y* coord.y*coord.y);
     118        this->getControllableEntity()->rotateYaw(-0.8f*sgn(coord.x)*coord.x*coord.x);
     119        this->getControllableEntity()->rotatePitch(0.8f*sgn(coord.y)*coord.y*coord.y);
     120//         this->getControllableEntity()->rotateYaw(10);
     121//         this->getControllableEntity()->rotatePitch(0);
    124122                //this->getControllableEntity()->rotatePitch(rotation.getPitch().valueRadians());
    125123                //this->getControllableEntity()->rotateYaw(rotation.getYaw().valueRadians());
Note: See TracChangeset for help on using the changeset viewer.