Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 3708 in orxonox.OLD for orxonox/trunk/src/world_entities


Ignore:
Timestamp:
Apr 1, 2005, 1:41:38 PM (20 years ago)
Author:
patrick
Message:

orxonox/trunk: added testbullet class. some changes in the weapon class to make it look much better and also more performant

Location:
orxonox/trunk/src/world_entities
Files:
2 added
3 edited

Legend:

Unmodified
Added
Removed
  • orxonox/trunk/src/world_entities/projectile.cc

    r3690 r3708  
    6262   tick function
    6363*/
    64 void Projectile::setFlightDirection(Quaternion* flightDirection)
     64void Projectile::setFlightDirection(Quaternion flightDirection)
    6565{
    6666  if( this->flightDirection == NULL)
    6767    this->flightDirection = new Vector();
    6868  Vector v(1, 0, 0);
    69   *this->flightDirection = flightDirection->apply(v);
     69  *this->flightDirection = flightDirection.apply(v);
    7070  this->flightDirection->normalize();
    7171}
     
    8989void Projectile::setSpeed(float speed)
    9090{
    91   this->speed = speed * 3;
     91  this->speed = speed * 3; /* fix speed settings */
    9292  PRINTF(4)("Projectile::setting speed to: %f\n", this->speed);
    9393}
     
    9999void Projectile::tick (float time)
    100100{
    101   //this->speed = this->weapon->getSpeed();
    102   Vector v;
    103   v = *this->flightDirection * ( this->speed * time * 1000 + 0.7);
     101  Vector v = *this->flightDirection * ( this->speed * time * 1000 + 0.7);
    104102  this->shiftCoor(v);
    105   //printf("PROJECTILE: current direction is:    (%f, %f, %f)\n",this->flightDirection->x, this->flightDirection->y, this->flightDirection->z );
    106   //printf("PROJECTILE: current shift vector is: (%f, %f, %f)\n", v.x, v.y, v.z);
    107   //printf("PROJECTILE: current speed is: %f\n", this->speed);
    108   //printf("PROJECTILE: current dt is:    %f\n", time);
    109   //this->debug();
    110103
    111104  this->currentLifeTime += time;
    112105  if( this->ttl < this->currentLifeTime)
    113106    {
    114       PRINTF(5)("FINALIZE=============================================================\n");
     107      PRINTF(5)("FINALIZE==========================\n");
    115108      PRINTF(5)("current life time is: %f/%f\n", this->currentLifeTime, this->ttl);
    116       PRINTF(5)("FINALIZE=============================================================\n");
     109      PRINTF(5)("FINALIZE===========================\n");
    117110      this->finalize();
    118111      this->currentLifeTime = 0.0f;
  • orxonox/trunk/src/world_entities/projectile.h

    r3683 r3708  
    2020  virtual ~Projectile ();
    2121
    22   void setFlightDirection(Quaternion* flightDirection);
     22  void setFlightDirection(Quaternion flightDirection);
    2323  void setSpeed(float speed);
    2424  void setTTL(float ttl);
  • orxonox/trunk/src/world_entities/test_gun.cc

    r3689 r3708  
    8585{
    8686  if( this->localTime < this->idleTime)
    87     return;
    88 
     87    {
     88      this->weaponIdle();
     89      return;
     90    }
    8991  Projectile* pj = new Projectile(this);
    9092
    91   Vector* v = new Vector();
    92   *v = this->getAbsCoor();
    93   pj->setAbsCoor(v);
    94   Quaternion* q = new Quaternion();
    95   *q = this->getAbsDir();
    96   pj->setAbsDir(q);
     93  pj->setAbsCoor(this->getAbsCoor());
     94  pj->setAbsDir(this->getAbsDir());
    9795
    98   printf("%f\n",this->getSpeed());
    99 
    100   pj->setFlightDirection(q);
     96  pj->setFlightDirection(this->getAbsDir());
    10197  pj->setSpeed(this->getSpeed());
    10298
Note: See TracChangeset for help on using the changeset viewer.