Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 4464 in orxonox.OLD for orxonox/trunk


Ignore:
Timestamp:
Jun 2, 2005, 1:18:44 AM (20 years ago)
Author:
patrick
Message:

orxonox/trunk: reimplemented the shoot speed function

Location:
orxonox/trunk/src/world_entities
Files:
4 edited

Legend:

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

    r4322 r4464  
    9393}
    9494
     95
     96/**
     97   \brief sets the velocity vector to a spec speed
     98   \param velocity: vector of the velocity
     99*/
     100void Projectile::setVelocity(const Vector &velocity)
     101{
     102  this->offsetVel = this->velocity = velocity;
     103  this->offsetVel.normalize();
     104  this->velocity += (this->offsetVel * 50.0);
     105}
     106
     107
    95108/**
    96109   \brief signal tick, time dependent things will be handled here
     
    99112void Projectile::tick (float time)
    100113{
    101   Vector v = *this->flightDirection * ( this->speed * time * 1000 + 0.7);
     114  Vector v = this->velocity * (time);
    102115  this->shiftCoor(v);
    103116
  • orxonox/trunk/src/world_entities/projectile.h

    r3710 r4464  
    2222
    2323#include "world_entity.h"
     24#include "vector.h"
    2425
    2526class Vector;
     
    3637  void setFlightDirection(Quaternion flightDirection);
    3738  void setSpeed(float speed);
     39  void setVelocity(const Vector &velocity);
    3840  void setTTL(float ttl);
    3941
     
    5254  Weapon* weapon;                      //!< weapon the shoot belongs to
    5355 
     56  Vector velocity;                     //!< velocity of the projectile
     57  Vector offsetVel;                    //!< offset velocity TEMP
    5458};
    5559
  • orxonox/trunk/src/world_entities/test_bullet.cc

    r4322 r4464  
    5858void TestBullet::tick (float time)
    5959{
    60   Vector v = *this->flightDirection * ( this->speed * time * 1000 + 0.1);
     60  //Vector v = *this->flightDirection * ( this->speed * time * 1000 + 0.1);
     61  Vector v = this->velocity * (time);
    6162  this->shiftCoor(v);
    6263
  • orxonox/trunk/src/world_entities/test_gun.cc

    r4391 r4464  
    145145
    146146  Projectile* pj = dynamic_cast<Projectile*>(ObjectManager::getInstance()->getFromDeadList(CL_TEST_BULLET));
    147 
    148   //printf( "object ref %p\n", ObjectManager::getInstance()->getFromDeadList(CL_TEST_BULLET));
    149 
    150   //Projectile* pj = new TestBullet(this);
    151147  pj->setAbsCoor(this->getAbsCoor() + this->projectileOffset);
    152148  pj->setAbsDir(this->getAbsDir());
    153   pj->setFlightDirection(this->getAbsDir());
    154   pj->setSpeed(this->getSpeed());
     149  pj->setVelocity(this->getVelocity());
    155150  this->worldEntities->add(pj);
    156151  this->localTime = 0;
Note: See TracChangeset for help on using the changeset viewer.