Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jul 25, 2005, 3:48:55 PM (20 years ago)
Author:
bensch
Message:

orxonox/trunk: extemely stupid aiming, but it works. Had to fix quite a few bugs in the process.

File:
1 edited

Legend:

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

    r4953 r4955  
    2626#include "model.h"
    2727#include "test_bullet.h"
     28#include "weapon_manager.h"
    2829
    2930#include "state.h"
     
    4445   creates a new weapon
    4546*/
    46 TestGun::TestGun (int leftRight)
     47TestGun::TestGun (WeaponManager* weaponManager, int leftRight)
     48  : Weapon(weaponManager)
    4749{
    4850  this->setClassID(CL_TEST_GUN, "TestGun");
     
    158160  Projectile* pj =  dynamic_cast<Projectile*>(this->getProjectileFactory()->resurrect());
    159161
     162  PNode* target = this->getWeaponManager()->getFixedTarget();
     163
     164  if (target != NULL)
     165  {
     166    target->debugDraw();
     167    Vector test = ((target->getAbsCoor() - this->getAbsCoor())*5);
     168    pj->setVelocity(test/20.0);//this->getVelocity());
     169  }
     170  else
     171    pj->setVelocity(target->getVelocity());
     172
     173
    160174  pj->setAbsCoor(this->getEmissionPoint());
    161175  pj->setAbsDir(this->getAbsDir());
    162   pj->setVelocity(this->getVelocity());
    163176  State::getWorldEntityList()->add(pj);
    164177}
     
    191204void TestGun::draw ()
    192205{
     206  this->getWeaponManager()->getFixedTarget()->debugDraw(10);
     207
    193208  /* draw gun body */
    194209  glMatrixMode(GL_MODELVIEW);
Note: See TracChangeset for help on using the changeset viewer.