Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 6723 in orxonox.OLD for branches/spaceshipcontrol


Ignore:
Timestamp:
Jan 25, 2006, 5:25:15 PM (19 years ago)
Author:
snellen
Message:

aim.cc updated

Location:
branches/spaceshipcontrol/src/world_entities
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • branches/spaceshipcontrol/src/world_entities/space_ships/space_ship.cc

    r6692 r6723  
    367367     //this->shiftCoor((this->getAbsDirX())*-1);
    368368     //accel -= (this->getAbsDirX())*2;
     369    //if(velocity.len() > 50)
    369370     accel -= (this->getAbsDirX())*0.5*acceleration;
     371
     372
     373
    370374   }
    371375
  • branches/spaceshipcontrol/src/world_entities/weapons/aim.cc

    r6637 r6723  
    7373  this->source = NULL;
    7474
    75   this->range = 0;
    76   this->angle = 0;
     75  this->range = 10000;
     76  this->angle = M_PI_4;
     77  this->group = OM_GROUP_01;
    7778  this->anim = new tAnimation<Aim>(this, &Aim::setSize);
    7879  this->anim->setInfinity(ANIM_INF_CONSTANT);
     
    106107{
    107108  std::list<WorldEntity*>::iterator entity;
    108   Vector diffVec(0.0, 0.0, 0.0);
    109   diffVec = ( this->getAbsCoor() - this->source->getAbsCoor() );
    110 
    111 //only look for target if the aim hasn`t locked a target yet or if the actual target is out of range
    112   if( this == PNode::getNullParent() || diffVec.len() > range  || ( acos( (this->source->getAbsDirX()).dot(diffVec)/(diffVec.len() * (this->source->getAbsDirX()).len() ) ) > angle))
    113   for (entity = State::getObjectManager()->getObjectList(OM_GROUP_00).begin();
    114        entity != State::getObjectManager()->getObjectList(OM_GROUP_00).end();
     109
     110  for (entity = State::getObjectManager()->getObjectList(group).begin();
     111       entity != State::getObjectManager()->getObjectList(group).end();
    115112       entity ++)
    116113  {
     
    119116    if ( diffVec.len() < range  &&  acos( (this->source->getAbsDirX()).dot(diffVec)/(diffVec.len() * (this->source->getAbsDirX()).len() ) ) < angle)
    120117    {
    121       if (this->getParent() != (*entity))
     118      //if (this->getParent() != (*entity))
    122119      {
    123120        this->anim->replay();
     
    127124    }
    128125  }
    129 //if no target found:
    130   this->setParent(PNode::getNullParent());
     126
     127   //if no target found:
     128   this->setParent(PNode::getNullParent());
     129
     130
     131
    131132}
    132133
     
    165166
    166167//  if (this->source->getAbsCoor().x > this->getAbsCoor().x )
     168  diffVec = ( this->getAbsCoor() - this->source->getAbsCoor() );
     169//only look for target if the aim hasn`t locked a target yet or if the actual target is out of range
     170   if(this->getParent() == PNode::getNullParent() ||
     171      diffVec.len() > range  ||
     172      ( acos( (this->source->getAbsDirX()).dot(diffVec)/(diffVec.len() * (this->source->getAbsDirX()).len() ) ) > angle))
     173    {
    167174     this->searchTarget();
     175    }
     176
    168177//   float z = 0.0f;
    169178//   glReadPixels ((int)this->getAbsCoor2D().x,
     
    196205{
    197206
     207 if( this->getParent() != PNode::getNullParent() )
     208  {
    198209  glPushMatrix();
    199210  glTranslatef(this->getAbsCoor2D().x, this->getAbsCoor2D().y, 0);
     
    212223  glEnd();
    213224  glPopMatrix();
    214 
    215 }
     225  }
     226
     227}
  • branches/spaceshipcontrol/src/world_entities/weapons/aim.h

    r6637 r6723  
    99#include "p_node.h"
    1010#include "element_2d.h"
     11#include "object_manager.h"
    1112
    1213// FORWARD DECLARATION
     
    4243  void setRange(float range){this->range = range;};
    4344  void setAngle(float angle){this->angle = angle;};
     45  void setGroup(OM_LIST group){this->group = group;};
    4446
    4547  void setSize(float size);
     
    5860   float            range;                //!<
    5961   float            angle;                //!<
     62   Vector           diffVec;
     63   OM_LIST          group;
    6064
    6165   PNode*           source;               //!< Where this Shot has come from.
  • branches/spaceshipcontrol/src/world_entities/weapons/aiming_turret.cc

    r6671 r6723  
    9898  this->target = new Aim(this);
    9999  this->target->setVisibility(false);
    100   this->target->setRange(100);
    101   this->target->setAngle(M_PI);
     100  this->target->setRange(1000);
     101  this->target->setAngle(M_PI_4);
    102102}
    103103
     
    148148  pj->setAbsDir(this->getAbsDir());
    149149  pj->activate();
    150   this->target->searchTarget();
    151150}
    152151
  • branches/spaceshipcontrol/src/world_entities/weapons/targeting_turret.cc

    r6671 r6723  
    9393  this->target->setVisibility(false);
    9494  this->target->setRange(100);
    95   this->target->setAngle(M_PI_4/2);
     95  this->target->setAngle(M_PI_4/16);
    9696  this->lockedTime = 0;
    9797  this->neededLockTime = 2;
     
    147147            /*target->getAbsCoor() - this->getAbsCoor()*/)*.5);//this->getVelocity());
    148148
    149   pj->setTarget(this->target->getParent());
     149  pj->setTarget(lockedTarget);
    150150  pj->setParent(PNode::getNullParent());
    151151  pj->setAbsCoor(this->getEmissionPoint());
    152152  pj->setAbsDir(this->getAbsDir());
    153153  pj->activate();
    154   this->target->searchTarget();
     154 
    155155}
    156156
Note: See TracChangeset for help on using the changeset viewer.