Changeset 3632 in orxonox.OLD for orxonox/trunk/src/world_entities
- Timestamp:
- Mar 22, 2005, 12:36:39 PM (20 years ago)
- Location:
- orxonox/trunk/src/world_entities
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/src/world_entities/projectile.cc
r3631 r3632 34 34 //this->model = new OBJModel(""); 35 35 this->projectileModel = new Primitive(P_SPHERE); 36 this->flightDirection = NULL; 37 this->speed = 1.0f; 36 38 } 37 39 … … 51 53 52 54 /** 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 */ 61 void 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 /** 53 71 \brief signal tick, time dependent things will be handled here 54 72 \param time since last tick 55 73 */ 56 74 void Projectile::tick (float time) 57 {} 75 { 76 *this->flightDirection = *this->flightDirection * speed; 77 this->shiftCoor(this->flightDirection); 78 } 58 79 59 80 /** -
orxonox/trunk/src/world_entities/projectile.h
r3618 r3632 10 10 11 11 class Primitive; 12 class Vector; 12 13 13 14 class Projectile : public WorldEntity … … 19 20 virtual ~Projectile (); 20 21 22 void setFlightDirection(Quaternion* flightDirection); 23 21 24 virtual void hit (WorldEntity* weapon, Vector* loc); 22 25 virtual void destroy (); … … 27 30 private: 28 31 //physical attriutes like: force, speed, acceleration etc. 29 Primitive* projectileModel; 30 32 Primitive* projectileModel; //!< this serves temporary as a plasma bullet 33 float speed; //!< this is the speed of the projectile 34 Vector* flightDirection; //!< direction in which the shoot flights 31 35 }; 32 36 -
orxonox/trunk/src/world_entities/test_gun.cc
r3631 r3632 83 83 { 84 84 printf("TestGun::fire() - firing weapon now ---------------------------\n"); 85 WorldEntity* pj = new Projectile(); 86 pj->setAbsCoor( &this->getAbsCoor()); 87 pj->setAbsDir( &this->getAbsDir()); 85 Projectile* pj = new Projectile(); 86 Vector* v = new Vector(); 87 *v = this->getAbsCoor(); 88 pj->setAbsCoor(v); 89 Quaternion* q = new Quaternion(); 90 *q = this->getAbsDir(); 91 pj->setAbsDir(q); 92 93 pj->setFlightDirection(q); 94 88 95 this->worldEntities->add(pj); 89 96 }
Note: See TracChangeset
for help on using the changeset viewer.