Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 5764 in orxonox.OLD for branches/guidedmissile/src


Ignore:
Timestamp:
Nov 24, 2005, 4:29:29 PM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: guided_missiles rock

Location:
branches/guidedmissile/src/world_entities/weapons
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • branches/guidedmissile/src/world_entities/weapons/aiming_turret.cc

    r5762 r5764  
    145145    pj->setVelocity(/*this->getVelocity()+*/(this->getAbsDir().apply(Vector(1,0,0))*250.0 + VECTOR_RAND(13)
    146146            /*target->getAbsCoor() - this->getAbsCoor()*/)*.5);//this->getVelocity());
     147    pj->setTarget(this->target->getParent());
     148
    147149
    148150  pj->setParent(NullParent::getInstance());
  • branches/guidedmissile/src/world_entities/weapons/guided_missile.cc

    r5761 r5764  
    4242
    4343  float modelSize = .3;
    44   this->loadModel("models/projectiles/orx-guided_missile.obj", .3);
     44  this->loadModel("models/projectiles/orx-rocket.obj", .3);
    4545
    4646  this->energyMin = 1;
     
    4848  this->remove();
    4949  this->lifeSpan = 5;
    50   this->agility = 1;
     50  this->agility = 5;
    5151
    5252  this->emitter = new ParticleEmitter(Vector(0,1,0), M_2_PI, 100, 5);
     
    8282ParticleSystem* GuidedMissile::explosionParticles = NULL;
    8383
    84 
    85 void GuidedMissile::setTarget(PNode* target)
    86 {
    87 
    88   this->target.setParent(target);
    89 
    90 }
    9184
    9285
     
    158151  //Vector v = *this->flightDirection * ( this->speed * time * 1000 + 0.1);
    159152  float speed = velocity.len();
    160   velocity += ((target.getAbsCoor() - this->getAbsCoor()).getNormalized())*agility;
    161   velocity *= speed/velocity.len();
     153  if (target != NULL)
     154   {
     155     velocity += ((target->getAbsCoor() - this->getAbsCoor()).getNormalized())*agility;
     156     velocity *= speed/velocity.len();
     157   }
    162158  Vector v = this->velocity * (time);
    163159  this->shiftCoor(v);
  • branches/guidedmissile/src/world_entities/weapons/guided_missile.h

    r5760 r5764  
    2222    virtual ~GuidedMissile ();
    2323
    24     void setTarget(PNode* target);
    2524    virtual void activate();
    2625    virtual void deactivate();
     
    4039
    4140    ParticleEmitter*                  emitter;
    42     PNode                             target;
    4341    float                             agility;
    4442
  • branches/guidedmissile/src/world_entities/weapons/projectile.cc

    r5511 r5764  
    3838  this->lifeCycle = 0.0;
    3939  this->lifeSpan = 1.0f; /* sec */
     40  this->target = NULL;
    4041
    4142  this->remove();
     
    9899}
    99100
     101
     102
     103void Projectile::setTarget(PNode* target)
     104{
     105
     106  if (this->target == NULL)
     107     this->target = new PNode();
     108  this->target->setParent(target);
     109}
     110
     111
    100112/**
    101113 * signal tick, time dependent things will be handled here
  • branches/guidedmissile/src/world_entities/weapons/projectile.h

    r5500 r5764  
    3131    inline bool isChageable() { return this->bChargeable; };
    3232
     33    void setTarget(PNode* target);
    3334
    3435    /** @brief This is called, when the Projectile is Emitted */
     
    5455
    5556    Vector                velocity;                  //!< velocity of the projectile.
     57
     58    PNode*                target;                    //!< A target for guided Weapons.
    5659};
    5760
  • branches/guidedmissile/src/world_entities/weapons/turret.cc

    r5750 r5764  
    138138    pj->setVelocity(this->getVelocity()+(this->getAbsDir().apply(Vector(1,0,0))*100.0 + VECTOR_RAND(13)
    139139            /*target->getAbsCoor() - this->getAbsCoor()*/)*.5);//this->getVelocity());
     140 
    140141
    141142  pj->setParent(NullParent::getInstance());
Note: See TracChangeset for help on using the changeset viewer.