Changeset 10079 in orxonox.OLD for branches/playability
- Timestamp:
- Dec 15, 2006, 8:34:47 AM (18 years ago)
- Location:
- branches/playability/src
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/playability/src/lib/coord/p_node.h
r9964 r10079 133 133 inline const Quaternion& getRelDir () const { return this->prevRelDirection; }; 134 134 /** @returns the Relative Directional Destination */ 135 inline const Quaternion& getRelDirSoft2D() const { return (this->toDirection)? *this->toDirection : this->relDirection; };135 inline const Quaternion& getRelDirSoft2D() const { return (this->toDirection)? *this->toDirection : this->relDirection; }; 136 136 /** @returns a Vector pointing into the relative Direction */ 137 137 inline Vector getRelDirV() const { return this->prevRelDirection.apply(Vector(0,1,0)); }; -
branches/playability/src/world_entities/projectiles/hbolt.cc
r10074 r10079 28 28 29 29 // #include "effects/billboard.h" 30 #include "space_ships/space_ship.h" 30 31 31 32 … … 98 99 } 99 100 100 this->set Damage(100);101 this->setPhysDamage(100); 101 102 this->setHealth(0); 102 103 } … … 117 118 void HBolt::collidesWith(WorldEntity* entity, const Vector& location) 118 119 { 120 PRINTF(0)("Collision with HBolt\n"); 119 121 if (this->hitEntity != entity && entity->isA(CL_NPC)) 120 122 this->destroy( entity ); 121 123 this->hitEntity = entity; 124 dynamic_cast<SpaceShip*>(entity)->damage(this->getPhysDamage(),0); 125 // this->deactivate(); 122 126 } 123 127 … … 142 146 this->deactivate(); 143 147 144 //float w = this->rotationSpeed * M_PI; 145 //Quaternion rotation(this->rotationSpeed * dt, this->axis); 146 //Quaternion u = this->getRelDir(); 147 //this->setRelDir(u * rotation); 148 this->updateAngle(dt); 148 149 149 this->updateAngle(dt);150 150 151 151 } -
branches/playability/src/world_entities/projectiles/lbolt.cc
r10074 r10079 28 28 #include <cassert> 29 29 #include "debug.h" 30 31 #include "space_ships/space_ship.h" 30 32 31 33 … … 116 118 void LBolt::collidesWith(WorldEntity* entity, const Vector& location) 117 119 { 120 PRINTF(0)("Collision with LBolt\n"); 118 121 if (this->hitEntity != entity && entity->isA(CL_NPC)) 119 122 this->destroy( entity ); 120 123 this->hitEntity = entity; 124 dynamic_cast<SpaceShip*>(entity)->damage(this->getDamage(),0); 125 // this->deactivate(); 121 126 } 122 127 -
branches/playability/src/world_entities/projectiles/swarm_projectile.cc
r10078 r10079 28 28 29 29 #include "class_id_DEPRECATED.h" 30 31 #include "math/vector.h" 30 32 31 33 ObjectListDefinitionID(SwarmProjectile, CL_SWARM_PROJECTILE); … … 54 56 55 57 this->target = NULL; 56 57 this->rotationSpeed = 100;58 this->angle = 0;59 58 } 60 59 … … 128 127 129 128 this->setHealth(10.0* (float)rand()/(float)RAND_MAX); 129 130 this->maxVelocity = 300; 131 132 this->rotationSpeed = 100; 133 this->angle = 0; 130 134 } 131 135 … … 216 220 this->shiftCoor(v);*/ 217 221 218 float projectileVelocity = this->velocity.len(); 219 if (target != NULL){ 220 float tti; //Time To Impact 221 float targetVelocity = this->target->getVelocity().len(); 222 if (unlikely(projectileVelocity == 0 && targetVelocity == 0)) // TODO calculate this reasonably 223 tti = 1; // we do have a problem.... 224 else 225 tti = this->target->getRelCoor().len() / sqrt ( projectileVelocity * projectileVelocity + targetVelocity * targetVelocity); 226 Vector estTargetDir = (this->target->getRelCoor() + this->target->getVelocity()) * tti; 227 this->velocity = this->newDirection(this->velocity, estTargetDir, this->turningSpeed * time ); 228 } 229 else 230 if (likely(projectileVelocity != 0)) 231 this->velocity *= maxVelocity / projectileVelocity; // set speed to max 232 233 234 this->shiftCoor(velocity * time); 222 // float projectileVelocity = this->getVelocity().len(); 223 // if (target != NULL){ 224 // float tti; //Time To Impact 225 // // float targetVelocity = this->target->getVelocity().len(); 226 // // /* if (unlikely(projectileVelocity == 0 && targetVelocity == 0)) // TODO calculate this reasonably*/ 227 // tti = 1; // we do have a problem.... 228 // // // else 229 // // // tti = (this->getAbsCoor() - this->target->getAbsCoor()).len() / sqrt ( projectileVelocity * projectileVelocity + targetVelocity * targetVelocity); 230 // Vector estTargetDir = this->getAbsCoor() - this->target->getAbsCoor() + this->target->getVelocity() * (0.5); 231 // // this->setVelocity((this->getAbsCoor() - this->target->getAbsCoor()).getNormalized() * this->velocity.len()); 232 // this->velocity = this->newDirection(this->velocity, estTargetDir, this->turningSpeed * time ) * this->maxVelocity; 233 // } 234 // else 235 // if (likely(projectileVelocity != 0)) 236 // this->velocity *= (this->maxVelocity / projectileVelocity); // set speed to max 237 /* 238 Vector v = this->velocity + this->target->getAbsCoor() - this->getAbsCoor(); 239 v.normalize(); 240 v *= projectileVelocity;*/ 241 this->shiftCoor(velocity * (time)); 235 242 236 243 if(this->tickLifeCycle(time)) -
branches/playability/src/world_entities/projectiles/swarm_projectile.h
r10037 r10079 45 45 Vector correctionVector; 46 46 47 PNode*target;47 WorldEntity* target; 48 48 49 49 WorldEntity* hitEntity; // FIXME TEMPORARY -
branches/playability/src/world_entities/weapons/swarm_launcher.cc
r10078 r10079 99 99 100 100 this->setEmissionPoint(1.684, 0.472, 0); 101 this->getProjectileFactory()->prepare(5 );101 this->getProjectileFactory()->prepare(50); 102 102 103 103 this->setActionSound(WA_SHOOT, "sound/explosions/explosion_1.wav"); … … 147 147 for( ObjectList<Playable>::const_iterator eIterator = Playable::objectList().begin(); eIterator !=Playable::objectList().end(); eIterator++) 148 148 { 149 if( ((*eIterator)->getOMListNumber() == OM_GROUP_00) && ((*eIterator)->getClassCName() != "Weapon") && ((*eIterator)->getClassCName() != "Projectile") && ((*eIterator)->getAbsCoor() - this->getAbsCoor()).len() <= 100)149 if( ((*eIterator)->getOMListNumber() == OM_GROUP_00) && ((*eIterator)->getClassCName() != "Weapon") && ((*eIterator)->getClassCName() != "Projectile") && ((*eIterator)->getAbsCoor() - this->getAbsCoor()).len() <= 200) 150 150 { 151 151 pj = this->getProjectile(); 152 152 if (pj == NULL) 153 153 return; 154 pj->setVelocity(this->getVelocity()+(this->getAbsDir().apply(Vector(1,0,0))*165.0 + VECTOR_RAND(20))); 155 156 pj->setParent( PNode::getNullParent()); 157 pj->setAbsCoor( this->getEmissionPoint()); 158 pj->setAbsDir( this->getAbsDir()); 159 pj->setTarget( *eIterator); 160 pj->activate(); 154 155 pj->setVelocity(this->getVelocity()+(this->getAbsDir().apply(Vector(1,0,0))*115.0 + VECTOR_RAND(10))); 156 157 pj->setParent(PNode::getNullParent()); 158 pj->setAbsCoor(this->getEmissionPoint()); 159 pj->setAbsDir(this->getAbsDir()); 160 pj->setTarget( dynamic_cast<WorldEntity*>(*eIterator)); 161 pj->activate(); 162 161 163 } 162 164 }
Note: See TracChangeset
for help on using the changeset viewer.