Changeset 10132 in orxonox.OLD for branches/playability/src/world_entities/projectiles/swarm_projectile.cc
- Timestamp:
- Dec 20, 2006, 5:36:18 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/playability/src/world_entities/projectiles/swarm_projectile.cc
r10117 r10132 55 55 this->emitter->setSpread(M_PI, M_PI); 56 56 57 this->turningSpeed = 30;57 this->turningSpeed = 10; 58 58 59 59 this->physDamage = 200; … … 164 164 // printf("turning angle: %f\ntemp: %f\n", angle, tmp); 165 165 166 if( fabsf(angle) > fabsf(tmp) ) { angle = tmp; } 166 if( fabsf(angle) > fabsf(tmp) ) 167 angle = tmp; 168 else 169 angle *= tmp/fabsf(tmp); 167 170 168 171 Vector d = curDirection.cross(estTargetDir).cross(curDirection); 169 172 d.normalize(); 170 if( unlikely( angle== 90)) { return d; } //avoid complication173 if( unlikely( fabsf(angle) == 90)) { return d; } //avoid complication 171 174 172 175 Vector newDir = curDirection + d * curDirection.len() * tan (angle); … … 221 224 // else 222 225 // tti = (this->getAbsCoor() - this->target->getAbsCoor()).len() / sqrt ( projectileVelocity * projectileVelocity + targetVelocity * targetVelocity); 223 Vector estTargetDir = (this->target->getAbsCoor() - this->getAbsCoor()) ;226 Vector estTargetDir = (this->target->getAbsCoor() - this->getAbsCoor()).getNormalized(); 224 227 // estTargetDir.slerpTo(this->velocity, 1); 225 228 this->velocity = this->newDirection(this->velocity, estTargetDir, this->turningSpeed * time ); … … 275 278 glPushMatrix(); 276 279 277 Vector tmpDir = this->curDir *.7 + this->lastDir * .3; 280 Vector tmpDir = this->curDir; // *.7 + this->lastDir * .3; 281 tmpDir.slerpTo(this->lastDir, .4); 278 282 279 283 float matrix[4][4];
Note: See TracChangeset
for help on using the changeset viewer.