Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 6920 in orxonox.OLD


Ignore:
Timestamp:
Jan 31, 2006, 10:37:09 PM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: default target for turret and other weapons, that support targetting

Location:
trunk/src/world_entities/weapons
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/world_entities/weapons/turret.cc

    r6759 r6920  
    118118
    119119  Quaternion quat;
    120   Vector direction = this->getAbsCoor();/*this->getWeaponManager()->getFixedTarget()->getAbsCoor() - this->getAbsCoor();*/
     120  Vector direction;
     121  if (this->getDefaultTarget() == NULL)
     122    direction = this->getAbsCoor();
     123  else
     124    direction = this->getDefaultTarget()->getAbsCoor() - this->getAbsCoor();
    121125
    122126  direction.normalize();
  • trunk/src/world_entities/weapons/weapon.cc

    r6756 r6920  
    8787  this->emissionPoint.setParent(this);             //< One EmissionPoint, that is a PNode connected to the weapon. You can set this to the exitting point of the Projectiles
    8888
    89   this->target = NULL;                             //< Nothing is Targeted by default.
     89  this->defaultTarget = NULL;                      //< Nothing is Targeted by default.
    9090
    9191  this->projectile = CL_NULL;                      //< No Projectile Class is Connected to this weapon
  • trunk/src/world_entities/weapons/weapon.h

    r6803 r6920  
    127127    inline const Vector& getEmissionPoint() const { return this->emissionPoint.getAbsCoor(); };
    128128
    129     inline void setTarget(PNode* target) { this->target = target; };
     129    inline void setDefaultTarget(PNode* defaultTarget) { this->defaultTarget = defaultTarget; };
     130    inline PNode* getDefaultTarget() const { return this->defaultTarget; };
    130131
    131132    // STATE CHANGES //
     
    211212    GLGuiBar*            energyWidget;
    212213
    213     PNode*               target;                           //!< A target for targeting Weapons.
     214    PNode*               defaultTarget;                    //!< A target for targeting Weapons.
    214215
    215216    ////////////
  • trunk/src/world_entities/weapons/weapon_manager.cc

    r6918 r6920  
    281281    if (this->parent->isA(CL_PLAYABLE))
    282282      dynamic_cast<Playable*>(this->parent)->weaponConfigChanged();
     283    weapon->setDefaultTarget(this->crosshair);
    283284  }
    284285  PRINTF(3)("Added a new Weapon (%s::%s) to the WeaponManager: config %i/ slot %i\n", weapon->getClassName(), weapon->getName(), configID, slotID);
Note: See TracChangeset for help on using the changeset viewer.