Changeset 10104 in orxonox.OLD for branches/playability/src/world_entities/projectiles
- Timestamp:
- Dec 19, 2006, 8:00:52 PM (18 years ago)
- Location:
- branches/playability/src/world_entities/projectiles
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/playability/src/world_entities/projectiles/hbolt.cc
r10081 r10104 2 2 orxonox - the future of 3D-vertical-scrollers 3 3 4 Copyright (C) 2004 orx4 Copyright (C) 2004-2006 orx 5 5 6 6 This program is free software; you can redistribute it and/or modify … … 10 10 11 11 ### File Specific 12 main-programmer: Patrick Boenzli12 main-programmer: Nicolas Schlumberger, Marc Schaerrer 13 13 co-programmer: Benjamin Grauer 14 14 … … 29 29 // #include "effects/billboard.h" 30 30 #include "space_ships/space_ship.h" 31 32 31 33 32 #include "class_id_DEPRECATED.h" … … 60 59 this->halo->setSize(.65, .65); 61 60 this->halo->setTexture("hbolt_halo2.png"); 62 63 61 } 64 62 … … 118 116 void HBolt::collidesWith(WorldEntity* entity, const Vector& location) 119 117 { 120 PRINTF(0)("Collision with HBolt\n");121 if (this->hitEntity != entity && entity->isA(CL_NPC))118 printf("Collision with HBolt\n"); 119 if (this->hitEntity != entity/* && entity->isA(CL_NPC)*/ || entity == this->target) 122 120 this->destroy( entity ); 123 121 this->hitEntity = entity; 124 122 dynamic_cast<SpaceShip*>(entity)->damage( this->getPhysDamage(), this->getElecDamage()); 125 this->deactivate(); 126 } 127 128 129 void HBolt::updateAngle (float time) 130 { 131 this->angle += this->rotationSpeed * time; 123 // this->deactivate(); 132 124 } 133 125 … … 146 138 this->deactivate(); 147 139 148 this-> updateAngle(dt);140 this->angle += this->rotationSpeed * dt; 149 141 150 142 … … 183 175 this->getModel()->draw(); 184 176 185 // this->mat->select();186 /* dynamic_cast<StaticModel*>(this->getModel())->draw();*/187 // this->mat->select();188 // dynamic_cast<StaticModel*>(this->getModel())->draw();189 // this->mat->unselect();190 191 192 177 glPopMatrix(); 193 178 } -
branches/playability/src/world_entities/projectiles/hbolt.h
r10074 r10104 34 34 virtual void draw () const; 35 35 36 virtual void updateAngle(float time);37 inline float getAngle() { return this->angle; };38 39 36 private: 40 37 static FastFactory* fastFactory; -
branches/playability/src/world_entities/projectiles/lbolt.cc
r10079 r10104 2 2 orxonox - the future of 3D-vertical-scrollers 3 3 4 Copyright (C) 2004 orx4 Copyright (C) 2004-2006 orx 5 5 6 6 This program is free software; you can redistribute it and/or modify … … 10 10 11 11 ### File Specific 12 main-programmer: Patrick Boenzli12 main-programmer: Nicolas Schlumberger, Marc Schaerrer 13 13 co-programmer: Benjamin Grauer 14 14 -
branches/playability/src/world_entities/projectiles/mbolt.cc
r10098 r10104 2 2 orxonox - the future of 3D-vertical-scrollers 3 3 4 Copyright (C) 2004 orx4 Copyright (C) 2004-2006 orx 5 5 6 6 This program is free software; you can redistribute it and/or modify … … 10 10 11 11 ### File Specific 12 main-programmer: Patrick Boenzli12 main-programmer: Marc Schaerrer 13 13 co-programmer: Benjamin Grauer 14 14 -
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 ); -
branches/playability/src/world_entities/projectiles/projectile.h
r10035 r10104 50 50 virtual void destroy (WorldEntity* killer); 51 51 52 virtual void collidesWith ( SpaceShip* target, const Vector& location); //!< collision handler; used against SpaceShip as most target will be52 virtual void collidesWith (WorldEntity* target, const Vector& location); //!< collision handler; used against SpaceShip as most target will be 53 53 54 54 … … 82 82 83 83 PNode* target; //!< A target for guided Weapons. 84 //Vector targetPosition; //!< current target position relative to projectile85 //Vector targetVelocity; //!< current target speed and direction86 //float eta; //!< estimated time of arrival == time to kaboom!87 84 88 85 OrxSound::SoundSource soundSource; -
branches/playability/src/world_entities/projectiles/swarm_projectile.cc
r10095 r10104 3 3 orxonox - the future of 3D-vertical-scrollers 4 4 5 Copyright (C) 2004 orx5 Copyright (C) 2004-2006 orx 6 6 7 7 This program is free software; you can redistribute it and/or modify … … 11 11 12 12 ### File Specific 13 main-programmer: Silvan Nellen13 main-programmer: Marc Schaerrer, Nicolas Schlumberger 14 14 co-programmer: 15 15 … … 58 58 59 59 this->physDamage = 200; 60 this->elecDamage = 0; 60 61 61 62 this->trail = new Trail(2.5,4,.2, this); … … 135 136 this->destroy( entity ); 136 137 this->hitEntity = entity; 137 dynamic_cast<SpaceShip*>(entity)->damage(this->getPhysDamage(),0); 138 dynamic_cast<SpaceShip*>(entity)->damage(this->getPhysDamage(),this->getElecDamage()); 139 this->destroy(NULL); 138 140 } 139 141 … … 219 221 // else 220 222 // tti = (this->getAbsCoor() - this->target->getAbsCoor()).len() / sqrt ( projectileVelocity * projectileVelocity + targetVelocity * targetVelocity); 221 Vector estTargetDir = (this->target->getAbsCoor() - this->getAbsCoor()).getNormalized() * maxVelocity; 223 Vector estTargetDir = (this->target->getAbsCoor() - this->getAbsCoor()); 224 // estTargetDir.slerpTo(this->velocity, 1); 222 225 this->velocity = this->newDirection(this->velocity, estTargetDir, this->turningSpeed * time ); 223 226 } 224 227 else 225 if (likely(projectileVelocity != 0 ))228 if (likely(projectileVelocity != 0 || projectileVelocity != this->maxVelocity) ) 226 229 this->velocity *= (this->maxVelocity / projectileVelocity); // set speed to max 227 230 … … 240 243 this->lastDir = this->curDir; 241 244 this->curDir = this->velocity; 242 if( (this->getAbsCoor() - this->target->getAbsCoor()).len() < 4) // FIXME Temp fake workaround for collision :)245 if( (this->getAbsCoor() - this->target->getAbsCoor()).len() < 1) // FIXME Temp fake workaround for collision :) 243 246 { 244 247 dynamic_cast<WorldEntity*>(target)->destroy( this); … … 253 256 { 254 257 255 printf("THIS SHOULD WOR Lk\n");258 printf("THIS SHOULD WORK!\n"); 256 259 257 260 Projectile::destroy( killer ); … … 272 275 glPushMatrix(); 273 276 274 Vector tmpDir = this->curDir *. 5 + this->lastDir * .5;277 Vector tmpDir = this->curDir *.7 + this->lastDir * .3; 275 278 276 279 float matrix[4][4];
Note: See TracChangeset
for help on using the changeset viewer.