Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Aug 4, 2005, 11:19:29 AM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: ability to set a Slots Direction

File:
1 edited

Legend:

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

    r4967 r4969  
    4242  this->setClassID(CL_TURRET, "Turret");
    4343
    44   this->model = (Model*)ResourceManager::getInstance()->load("models/turret1.obj", OBJ, RP_CAMPAIGN);
     44  this->loadModel("models/turret1.obj");
    4545
    4646  Animation3D* animation1 = this->getAnimation(WS_ACTIVATING, this);
     
    9595  Vector direction = this->getWeaponManager()->getFixedTarget()->getAbsCoor() - this->getAbsCoor();
    9696  direction.normalize();
    97   Quaternion quat = Quaternion(direction, this->getParent()->getAbsDir().apply(Vector(0,1,0))) * Quaternion ( -M_PI_2, Vector(0,1,0)) ;
    98 
    99   this->setAbsDir(quat);
     97  if (likely (this->getParent() != NULL))
     98  {
     99    Quaternion quat = Quaternion(direction, this->getParent()->getAbsDir().apply(Vector(0,1,0))) * Quaternion ( -M_PI_2, Vector(0,1,0)) ;
     100    this->setAbsDir(quat);
     101  }
     102  else
     103  {
     104    Quaternion quat = Quaternion(direction, this->getAbsDir().apply(Vector(0,1,0))) * Quaternion ( -M_PI_2, Vector(0,1,0)) ;
     105    this->setAbsDir(quat);
     106  }
    100107}
    101108
    102 /**
    103  *  fires the weapon
    104 
    105    this is called from the player.cc, when fire-button is been pushed
    106 */
    107109void Turret::fire()
    108110{
     
    126128
    127129
    128 /**
    129  *  is called, when the weapon is destroyed
    130 
    131    this is in conjunction with the hit function, so when a weapon is able to get
    132    hit, it can also be destoryed.
    133 */
    134130void Turret::destroy ()
    135131{}
    136132
    137133/**
    138  *  this will draw the weapon
     134 * draws the Turret
    139135*/
    140136void Turret::draw ()
Note: See TracChangeset for help on using the changeset viewer.