Changeset 10104 in orxonox.OLD for branches/playability/src/world_entities/projectiles/projectile.cc
- Timestamp:
- Dec 19, 2006, 8:00:52 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/playability/src/world_entities/projectiles/projectile.cc
r10035 r10104 153 153 154 154 155 void Projectile::collidesWith ( SpaceShip* target, const Vector& location)155 void Projectile::collidesWith (WorldEntity* target, const Vector& location) 156 156 { 157 target->damage(this->physDamage, this->elecDamage); 157 dynamic_cast<SpaceShip*>(target)->damage(this->getPhysDamage(),this->getElecDamage()); 158 // this->destroy(NULL); 158 159 this->destroy(target); 159 160 } 160 161 161 162 /**163 * this function gets called by tick to calculate the new flight direction164 * @param curDirection direction vector165 * @param estTargetDir target vector, pointing to where the target will be on hit166 * @param angle = tick * turningSpeed167 * @return normalized (new) direction vector168 */169 // Vector Projectile::newDirection(Vector curDirection, Vector estTargetDir, float angle)170 // {171 // float tmp = angleDeg ( curDirection, estTargetDir);172 // if ( unlikely(tmp == 0) ) { return curDirection; }173 //174 // if( fabsf(angle) > fabsf(tmp) ) { angle = tmp; }175 //176 // Vector d = curDirection.cross(estTargetDir).cross(curDirection);177 // d.normalize();178 // if( unlikely( angle == 90)) { return d; }179 //180 // Vector newDir = curDirection + d * curDirection.len() * tan (angle);181 // newDir.normalize();182 // return newDir;183 // }184 162 185 163 … … 190 168 void Projectile::tick (float dt) 191 169 { 192 /*193 if (target != NULL){194 float tti = this->target->getRelCoor().len() / this->getVelocity().len();195 Vector estTargetDir = (this->target->getRelCoor() + this->target->getVelocity()) * tti;196 this->velocity = this->newDirection(this->velocity, estTargetDir, this->turningSpeed * dt ) * this->velocity.len();197 Vector v = this->velocity * (dt);198 this->shiftCoor(v);199 }*/200 201 170 if (this->tickLifeCycle(dt)) 202 171 this->destroy( NULL );
Note: See TracChangeset
for help on using the changeset viewer.