Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 9639 in orxonox.OLD for branches/proxy/src/world_entities


Ignore:
Timestamp:
Jul 31, 2006, 9:30:52 AM (18 years ago)
Author:
bensch
Message:

orxonox/trunk: tmuch better lookAt implementation, so that the Turrets are really aiming at the designated target.

File:
1 edited

Legend:

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

    r9617 r9639  
    3838*/
    3939AimingTurret::AimingTurret ()
    40   : Weapon(), target(this)
     40    : Weapon(), target(this)
    4141{
    4242  this->init();
     
    4646
    4747AimingTurret::AimingTurret(const TiXmlElement* root)
    48   : target(this)
     48    : target(this)
    4949{
    5050  this->init();
     
    5959{
    6060  // model will be deleted from WorldEntity-destructor
    61 //  delete this->target;
     61  //  delete this->target;
    6262}
    6363
     
    129129
    130130  if (likely (this->getParent() != NULL))
    131     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());
    132133  else
    133     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));
    134136
    135137  this->setAbsDirSoft(quat, 5);
     
    144146    return;
    145147
    146   pj->setVelocity(/*this->getVelocity()+*/(this->getAbsDir().apply(Vector(1,0,0))*250.0 + VECTOR_RAND(4)
    147             /*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());
    148150
    149151  pj->setParent(PNode::getNullParent());
Note: See TracChangeset for help on using the changeset viewer.