Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Mar 22, 2005, 12:36:39 PM (19 years ago)
Author:
patrick
Message:

orxonox/trunk: bullets now tick() but they shoot all over the place… some problems with the gundirection calculation :)

File:
1 edited

Legend:

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

    r3631 r3632  
    3434  //this->model = new OBJModel("");
    3535  this->projectileModel = new Primitive(P_SPHERE);
     36  this->flightDirection = NULL;
     37  this->speed = 1.0f;
    3638}
    3739
     
    5153
    5254/**
     55   \brief this sets the flight direction of the projectile
     56   \param directin in which to flight
     57
     58   this function will calculate a vector out of this to be used in the
     59   tick function
     60*/
     61void Projectile::setFlightDirection(Quaternion* flightDirection)
     62{
     63  if( this->flightDirection == NULL)
     64    this->flightDirection = new Vector();
     65  Vector v(1, 0, 0);
     66  *this->flightDirection = flightDirection->apply(v);
     67}
     68
     69
     70/**
    5371   \brief signal tick, time dependent things will be handled here
    5472   \param time since last tick
    5573*/
    5674void Projectile::tick (float time)
    57 {}
     75{
     76  *this->flightDirection = *this->flightDirection * speed;
     77  this->shiftCoor(this->flightDirection);
     78}
    5879
    5980/**
Note: See TracChangeset for help on using the changeset viewer.