Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Aug 4, 2006, 11:01:28 PM (18 years ago)
Author:
bensch
Message:

orxonox/trunk: merged the proxy bache back with no conflicts

File:
1 edited

Legend:

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

    r9406 r9656  
    3838*/
    3939AimingTurret::AimingTurret ()
    40   : Weapon()
     40    : Weapon(), target(this)
    4141{
    4242  this->init();
     
    4646
    4747AimingTurret::AimingTurret(const TiXmlElement* root)
     48    : target(this)
    4849{
    4950  this->init();
     
    5859{
    5960  // model will be deleted from WorldEntity-destructor
    60 //  delete this->target;
     61  //  delete this->target;
    6162}
    6263
     
    9192  //this->getProjectileFactory()->prepare(100);
    9293
    93   this->target = new Aim(this);
    94   this->target->setVisibility(false);
    95   this->target->setRange(400);
    96   this->target->setAngle(M_PI_2);
     94  this->target.addNodeFlags(PNODE_PROHIBIT_DELETE_WITH_PARENT | PNODE_PROHIBIT_CHILD_DELETE);
     95  this->target.setVisibility(false);
     96  this->target.setRange(400);
     97  this->target.setAngle(M_PI_2);
    9798
    9899  this->setActionSound(WA_SHOOT, "sound/explosions/explosion_3.wav");
     
    110111void AimingTurret::activate()
    111112{
    112   this->target->setVisibility(true);
     113  this->target.setVisibility(true);
    113114}
    114115
    115116void AimingTurret::deactivate()
    116117{
    117   this->target->setVisibility(false);
     118  this->target.setVisibility(false);
    118119}
    119120
     
    123124    return;
    124125  Quaternion quat;
    125   Vector direction = this->target->getAbsCoor() - this->getAbsCoor();
     126  Vector direction = this->target.getAbsCoor() - this->getAbsCoor();
    126127
    127128  direction.normalize();
    128129
    129130  if (likely (this->getParent() != NULL))
    130     quat = Quaternion(direction, this->getParent()->getAbsDir().apply(Vector(0,1,0))) * Quaternion ( -M_PI_2, Vector(0,1,0)) ;
     131    //quat = Quaternion(direction, this->getParent()->getAbsDirY()) * Quaternion ( -M_PI_2, Vector(0,1,0)) ;
     132    quat = Quaternion ( M_PI_2, this->getParent()->getAbsDirY()) * Quaternion::lookAt(this->getAbsCoor(), this->target.getAbsCoor(), this->getParent()->getAbsDirY());
    131133  else
    132     quat = Quaternion(direction, Vector(0,1,0)) * Quaternion ( -M_PI_2, Vector(0,1,0)) ;
     134    //quat = Quaternion(direction, Vector(0,1,0)) * Quaternion ( -M_PI_2, Vector(0,1,0)) ;
     135    quat = Quaternion ( M_PI_2, Vector(0,1,0)) * Quaternion::lookAt(this->getAbsCoor(), this->target.getAbsCoor(), Vector(0,1,0));
    133136
    134137  this->setAbsDirSoft(quat, 5);
    135138
    136   this->target->tick(dt);
     139  this->target.tick(dt);
    137140}
    138141
     
    143146    return;
    144147
    145   pj->setVelocity(/*this->getVelocity()+*/(this->getAbsDir().apply(Vector(1,0,0))*250.0 + VECTOR_RAND(13)
    146             /*target->getAbsCoor() - this->getAbsCoor()*/)*.5);//this->getVelocity());
     148  pj->setVelocity(/*this->getVelocity()+*/(this->getAbsDirX()*250.0 + VECTOR_RAND(4)
     149                                          /*target.getAbsCoor() - this->getAbsCoor()*/)*.5);//this->getVelocity());
    147150
    148151  pj->setParent(PNode::getNullParent());
Note: See TracChangeset for help on using the changeset viewer.