Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 10079 in orxonox.OLD for branches/playability/src


Ignore:
Timestamp:
Dec 15, 2006, 8:34:47 AM (18 years ago)
Author:
nicolasc
Message:

guiding system (somewhat not working)
minor cleanup in pnode.h
cd/cr in hbolt/lbolt

Location:
branches/playability/src
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • branches/playability/src/lib/coord/p_node.h

    r9964 r10079  
    133133  inline const Quaternion& getRelDir () const { return this->prevRelDirection; };
    134134  /** @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; };
    136136  /** @returns a Vector pointing into the relative Direction */
    137137  inline Vector getRelDirV() const { return this->prevRelDirection.apply(Vector(0,1,0)); };
  • branches/playability/src/world_entities/projectiles/hbolt.cc

    r10074 r10079  
    2828
    2929// #include "effects/billboard.h"
     30#include "space_ships/space_ship.h"
    3031
    3132
     
    9899  }
    99100
    100   this->setDamage(100);
     101  this->setPhysDamage(100);
    101102  this->setHealth(0);
    102103}
     
    117118void HBolt::collidesWith(WorldEntity* entity, const Vector& location)
    118119{
     120  PRINTF(0)("Collision with HBolt\n");
    119121  if (this->hitEntity != entity && entity->isA(CL_NPC))
    120122    this->destroy( entity );
    121123  this->hitEntity = entity;
     124  dynamic_cast<SpaceShip*>(entity)->damage(this->getPhysDamage(),0);
     125//   this->deactivate();
    122126}
    123127
     
    142146    this->deactivate();
    143147
    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);
    148149
    149   this->updateAngle(dt);
    150150
    151151}
  • branches/playability/src/world_entities/projectiles/lbolt.cc

    r10074 r10079  
    2828#include <cassert>
    2929#include "debug.h"
     30
     31#include "space_ships/space_ship.h"
    3032
    3133
     
    116118void LBolt::collidesWith(WorldEntity* entity, const Vector& location)
    117119{
     120  PRINTF(0)("Collision with LBolt\n");
    118121  if (this->hitEntity != entity && entity->isA(CL_NPC))
    119122    this->destroy( entity );
    120123  this->hitEntity = entity;
     124  dynamic_cast<SpaceShip*>(entity)->damage(this->getDamage(),0);
     125//   this->deactivate();
    121126}
    122127
  • branches/playability/src/world_entities/projectiles/swarm_projectile.cc

    r10078 r10079  
    2828
    2929#include "class_id_DEPRECATED.h"
     30
     31#include "math/vector.h"
    3032
    3133ObjectListDefinitionID(SwarmProjectile, CL_SWARM_PROJECTILE);
     
    5456
    5557  this->target = NULL;
    56 
    57   this->rotationSpeed = 100;
    58   this->angle = 0;
    5958}
    6059
     
    128127
    129128  this->setHealth(10.0* (float)rand()/(float)RAND_MAX);
     129
     130  this->maxVelocity = 300;
     131
     132  this->rotationSpeed = 100;
     133  this->angle = 0;
    130134}
    131135
     
    216220  this->shiftCoor(v);*/
    217221
    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));
    235242
    236243  if(this->tickLifeCycle(time))
  • branches/playability/src/world_entities/projectiles/swarm_projectile.h

    r10037 r10079  
    4545    Vector                            correctionVector;
    4646
    47     PNode*                            target;
     47    WorldEntity*                      target;
    4848
    4949    WorldEntity* hitEntity; // FIXME TEMPORARY
  • branches/playability/src/world_entities/weapons/swarm_launcher.cc

    r10078 r10079  
    9999
    100100  this->setEmissionPoint(1.684, 0.472, 0);
    101   this->getProjectileFactory()->prepare(5);
     101  this->getProjectileFactory()->prepare(50);
    102102
    103103  this->setActionSound(WA_SHOOT, "sound/explosions/explosion_1.wav");
     
    147147  for( ObjectList<Playable>::const_iterator eIterator = Playable::objectList().begin(); eIterator !=Playable::objectList().end(); eIterator++)
    148148  {
    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)
    150150    {
    151151      pj  = this->getProjectile();
    152152      if (pj == NULL)
    153153        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
    161163    }
    162164  }
Note: See TracChangeset for help on using the changeset viewer.