Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 6943


Ignore:
Timestamp:
May 20, 2010, 9:04:46 PM (14 years ago)
Author:
gnadler
Message:
 
Location:
code/branches/rocket
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • code/branches/rocket/data/levels/tutorial.oxw

    r6779 r6943  
    1616<Drone name="meineDrohne" primarythrust="80" auxilarythrust="10" rotationthrust="10" mass= "50" linearDamping = "0.9" angularDamping = "0.7">
    1717  <attached>
    18     <Model scale="10" mesh="drone.mesh"/>
     18    <Model scale="1" mesh="drone.mesh"/>
    1919  </attached>
    2020  <collisionShapes>
     
    2525<Drone name="meineDrohne" primarythrust="80" auxilarythrust="10" rotationthrust="10" mass= "50" linearDamping = "0.9" angularDamping = "0.7">
    2626  <attached>
    27     <Model scale="10" mesh="rocket.mesh"/>
     27    <Model scale="1" mesh="rocket.mesh"/>
    2828  </attached>
    2929  <collisionShapes>
  • code/branches/rocket/src/modules/weapons/RocketController.cc

    r6905 r6943  
    6363    {
    6464                haha++;
    65                
    6665
    67         SimpleRocket *rocket = static_cast<SimpleRocket*>(this->getControllableEntity());
    68                 if (haha<30)rocket->setVelocity(rocket->getVelocity()*1.03);
     66                //if (haha<30)this->rocket->setVelocity(rocket->getVelocity()*1.03);
    6967                if (this->target_) {
    7068                        this->setTargetPosition();
    7169                        this->moveToTargetPosition();
    72                
    7370                }
    74                
    7571                if (haha>500) rocket->setDestroy();;
    7672       
     
    8581
    8682        void RocketController::setTargetPosition() {
    87                 this->targetPosition_=this->target_->getPosition();
    88                 //this->targetPosition_ = getPredictedPosition(this->getControllableEntity()->getPosition(),this->getControllableEntity()->getVelocity().length() , this->target_->getPosition(), this->target_->getVelocity());
     83                //this->targetPosition_=this->target_->getWorldPosition();
     84                this->targetPosition_ = getPredictedPosition(this->getControllableEntity()->getPosition(),this->getControllableEntity()->getVelocity().length() , this->target_->getPosition(), this->target_->getVelocity());
    8985        }
    9086        void RocketController::moveToTargetPosition() {
     
    10399       if (!this->getControllableEntity())
    104100            return;
    105 
    106            COUT(0)<<"moving";
    107 
     101           float dx = target.x-this->getControllableEntity()->getPosition().x;
     102           float dy = target.y-this->getControllableEntity()->getPosition().y;
     103           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;
     109           //COUT(0)<<"\n 2D view: ";
     110          /* COUT(0)<<this->getControllableEntity()->getPosition().x;
     111           COUT(0)<<" ";
     112           COUT(0)<<this->getControllableEntity()->getPosition().y;
     113           COUT(0)<<" ";
     114           COUT(0)<<this->getControllableEntity()->getPosition().z;
     115           COUT(0)<<"\n";*/
    108116        Vector2 coord = get2DViewdirection(this->getControllableEntity()->getPosition(), this->getControllableEntity()->getOrientation() * WorldEntity::FRONT, this->getControllableEntity()->getOrientation() * WorldEntity::UP, target);
    109117        float distance = (target - this->getControllableEntity()->getPosition()).length();
    110 
    111         if (this->target_ || distance > 10)
    112         {
    113             // Multiply with 0.8 to make them a bit slower
    114                          this->getControllableEntity()->rotateYaw(-0.2f * sgn(coord.x) * coord.x*coord.x);
    115             this->getControllableEntity()->rotatePitch(0.2f * sgn(coord.y) * coord.y*coord.y);
    116                        
    117         }
     118                //Vector3D diff =target-this->rocket->getPosition();
     119                //COUT(0)<<coord.x;
     120                //COUT(0)<<"  ";
     121                //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);
     124                //this->getControllableEntity()->rotatePitch(rotation.getPitch().valueRadians());
     125                //this->getControllableEntity()->rotateYaw(rotation.getYaw().valueRadians());
     126                //this->getControllableEntity()->moveUpDown(coord.y);
     127                //this->getControllableEntity()->moveRightLeft(coord.x);
     128                //this->getControllableEntity()->rotatePitch(coord);
     129   //     if (this->target_ || distance > 10)
     130   //     {
     131   //         // Multiply with 0.8 to make them a bit slower
     132                        //this->getControllableEntity()->rotateYaw(coord.x );
     133   //         this->getControllableEntity()->rotatePitch(coord.y);
     134                        //
     135   //     }
    118136    }
    119137
  • code/branches/rocket/src/modules/weapons/weaponmodes/SimpleRocketFire.cc

    r6905 r6943  
    4949        this->bParallelReload_ = false;
    5050        this->damage_ = 100;
    51         this->speed_ = 50;
     51        this->speed_ = 1;
    5252
    5353        this->setMunitionName("LaserMunition");
     
    6767                Vector3 pos = this->getMuzzlePosition() + (this->getMuzzleOrientation()* Vector3(-2, -3, -2));
    6868        rocket->setPosition(pos);
     69                rocket->setAcceleration(20*rocket->getOrientation() * WorldEntity::FRONT);
    6970                rocket->setVelocity(this->getMuzzleDirection()*this->speed_);
    7071                rocket->setOwner(this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn());
    7172                rocket->setDamage(this->damage_);
    72                 WorldEntity* pawnn=(this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn()->getTarget());
     73                WorldEntity* pawnn=this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn()->getTarget();
    7374                if (pawnn) {
    7475                con->setTarget(pawnn);
Note: See TracChangeset for help on using the changeset viewer.