Changeset 3708 in orxonox.OLD for orxonox/trunk/src/world_entities
- Timestamp:
- Apr 1, 2005, 1:41:38 PM (20 years ago)
- Location:
- orxonox/trunk/src/world_entities
- Files:
-
- 2 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/src/world_entities/projectile.cc
r3690 r3708 62 62 tick function 63 63 */ 64 void Projectile::setFlightDirection(Quaternion *flightDirection)64 void Projectile::setFlightDirection(Quaternion flightDirection) 65 65 { 66 66 if( this->flightDirection == NULL) 67 67 this->flightDirection = new Vector(); 68 68 Vector v(1, 0, 0); 69 *this->flightDirection = flightDirection ->apply(v);69 *this->flightDirection = flightDirection.apply(v); 70 70 this->flightDirection->normalize(); 71 71 } … … 89 89 void Projectile::setSpeed(float speed) 90 90 { 91 this->speed = speed * 3; 91 this->speed = speed * 3; /* fix speed settings */ 92 92 PRINTF(4)("Projectile::setting speed to: %f\n", this->speed); 93 93 } … … 99 99 void Projectile::tick (float time) 100 100 { 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); 104 102 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();110 103 111 104 this->currentLifeTime += time; 112 105 if( this->ttl < this->currentLifeTime) 113 106 { 114 PRINTF(5)("FINALIZE========================== ===================================\n");107 PRINTF(5)("FINALIZE==========================\n"); 115 108 PRINTF(5)("current life time is: %f/%f\n", this->currentLifeTime, this->ttl); 116 PRINTF(5)("FINALIZE=========================== ==================================\n");109 PRINTF(5)("FINALIZE===========================\n"); 117 110 this->finalize(); 118 111 this->currentLifeTime = 0.0f; -
orxonox/trunk/src/world_entities/projectile.h
r3683 r3708 20 20 virtual ~Projectile (); 21 21 22 void setFlightDirection(Quaternion *flightDirection);22 void setFlightDirection(Quaternion flightDirection); 23 23 void setSpeed(float speed); 24 24 void setTTL(float ttl); -
orxonox/trunk/src/world_entities/test_gun.cc
r3689 r3708 85 85 { 86 86 if( this->localTime < this->idleTime) 87 return; 88 87 { 88 this->weaponIdle(); 89 return; 90 } 89 91 Projectile* pj = new Projectile(this); 90 92 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()); 97 95 98 printf("%f\n",this->getSpeed()); 99 100 pj->setFlightDirection(q); 96 pj->setFlightDirection(this->getAbsDir()); 101 97 pj->setSpeed(this->getSpeed()); 102 98
Note: See TracChangeset
for help on using the changeset viewer.