Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 6162 in orxonox.OLD for trunk/src/world_entities/weapons


Ignore:
Timestamp:
Dec 19, 2005, 4:52:01 PM (18 years ago)
Author:
bensch
Message:

orxonox/trunk: merged the spaceshipcontroll branche into the trunk
merged with command
svn merge -r6036:HEAD spaceshipcontrol/ ../trunk/
no conflicts

Location:
trunk/src/world_entities/weapons
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/world_entities/weapons/crosshair.cc

    r5978 r6162  
    6767  this->setSize(GraphicsEngine::getInstance()->getResolutionX()/10.0);
    6868
    69 //  this->setBindNode(this);
     69  this->setBindNode(this);
    7070  this->material = new Material;
    7171
     
    166166{
    167167  glPushMatrix();
    168   glTranslatef(GraphicsEngine::getInstance()->getResolutionX()/2, GraphicsEngine::getInstance()->getResolutionY()/2, 0);
     168  glTranslatef(this->getAbsCoor2D().x, this->getAbsCoor2D().y, 0);
    169169
    170170  glRotatef(this->getAbsDir2D(), 0,0,1);
  • trunk/src/world_entities/weapons/guided_missile.cc

    r6142 r6162  
    4545  this->energyMin = 1;
    4646  this->energyMax = 10;
    47   this->lifeSpan = 5.0;
    48   this->agility = 5.0;
    49   this->maxVelocity = 100;
     47  this->lifeSpan = 10.0;
     48  this->agility = 4;
     49  this->maxVelocity = 75;
    5050
    5151  this->emitter = new ParticleEmitter(Vector(0,1,0), M_2_PI, 100, 5);
     
    147147void GuidedMissile::tick (float time)
    148148{
    149   //Vector v = *this->flightDirection * ( this->speed * time * 1000 + 0.1);
     149
    150150  if (this->target != NULL && this->target->getParent() != PNode::getNullParent())
    151151   {
    152      velocity += ((target->getAbsCoor() - this->getAbsCoor()).getNormalized())*agility;
    153      float speed = velocity.len();
    154      if (speed > this->maxVelocity)
    155        velocity *= maxVelocity/speed;
     152    speed = velocity.len();
     153    diffVector = ((target->getAbsCoor() - this->getAbsCoor()).getNormalized());
     154
     155    if(velocity.dot(diffVector) != 0)
     156    {
     157     correctionVector = (( ( diffVector *  (speed * speed/( velocity.dot(diffVector ) ) )) - velocity).getNormalized()) * agility;
     158
     159      if(velocity.dot(diffVector) > 0)
     160        velocity += correctionVector;
     161      else if (velocity.dot(diffVector) < 0)
     162        velocity -= correctionVector;
     163    }
     164    else
     165      velocity += diffVector * agility;
    156166
    157167     this->setAbsDir(Quaternion(velocity, Vector(0,1,0)) * Quaternion ( -M_PI_2, Vector(0,1,0)));
    158168   }
     169
     170  velocity *= maxVelocity/velocity.len();
    159171  Vector v = this->velocity * (time);
    160172  this->shiftCoor(v);
  • trunk/src/world_entities/weapons/guided_missile.h

    r6054 r6162  
    4040    float                             agility;
    4141    float                             maxVelocity;
     42    float                             speed;
     43    Vector                            diffVector ;
     44    Vector                            correctionVector;
    4245
    4346    WorldEntity* hitEntity; // FIXME TEMPORARY
  • trunk/src/world_entities/weapons/laser.cc

    r6142 r6162  
    4545  this->energyMin = 1;
    4646  this->energyMax = 10;
    47   this->lifeSpan = 1.0;
     47  this->lifeSpan = 5.0;
    4848
    4949  this->emitter = new ParticleEmitter(Vector(0,1,0), M_2_PI, 100, 5);
  • trunk/src/world_entities/weapons/test_gun.cc

    r6074 r6162  
    184184  pj->setParent(PNode::getNullParent());
    185185
    186   pj->setVelocity(this->getVelocity() + this->getAbsDir().apply(Vector(1,0,0))*50+VECTOR_RAND(5));
     186  pj->setVelocity(this->getAbsDir().apply(Vector(1,0,0))*250 + VECTOR_RAND(5));
    187187
    188188  pj->setAbsCoor(this->getEmissionPoint());
Note: See TracChangeset for help on using the changeset viewer.