Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Nov 13, 2005, 4:30:07 PM (18 years ago)
Author:
bensch
Message:

orxonox/trunk: simple-aiming function, with visible targetting-system

File:
1 edited

Legend:

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

    r5527 r5559  
    1818
    1919#include "weapon_manager.h"
     20#include "aim.h"
    2021#include "projectile.h"
    2122
     
    4546  this->init();
    4647
    47   this->loadModel("models/guns/turret1.obj");
     48  this->loadModel("models/guns/turret2.obj");
    4849
    4950
     
    6667{
    6768  // model will be deleted from WorldEntity-destructor
     69  delete this->target;
    6870}
    6971
     
    99101  //this->getProjectileFactory()->prepare(100);
    100102
    101   this->target = NULL;
     103  this->target = new Aim();
    102104}
    103105
     
    119121{
    120122  Quaternion quat;
    121   if (this->target == NULL)
    122     this->target = this->getWeaponManager()->getDistanceTarget(this, 50);
    123123  Vector direction = this->target->getAbsCoor() - this->getAbsCoor();
    124124
     
    130130    quat = Quaternion(direction, Vector(0,1,0)) * Quaternion ( -M_PI_2, Vector(0,1,0)) ;
    131131
    132   this->setAbsDirSoft(quat, 20);
     132  this->setAbsDirSoft(quat, 5);
     133
     134  this->target->tick(dt);
    133135}
    134136
     
    143145  if (target != NULL)
    144146  {
    145     pj->setVelocity(/*this->getVelocity()+*/(this->getAbsDir().apply(Vector(1,0,0))*100.0 + VECTOR_RAND(13)
     147    pj->setVelocity(/*this->getVelocity()+*/(this->getAbsDir().apply(Vector(1,0,0))*250.0 + VECTOR_RAND(13)
    146148            /*target->getAbsCoor() - this->getAbsCoor()*/)*.5);//this->getVelocity());
    147149  }
     
    153155  pj->setAbsDir(this->getAbsDir());
    154156  pj->activate();
    155   this->target = this->getWeaponManager()->getDistanceTarget(this, 50);
     157  this->target->searchTarget(this);
    156158}
    157159
Note: See TracChangeset for help on using the changeset viewer.