Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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


Ignore:
Timestamp:
Jan 25, 2006, 5:35:49 PM (18 years ago)
Author:
bensch
Message:

merged the Spaceshipcontrol back to the trunk

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

Legend:

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

    r6637 r6724  
    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}
  • trunk/src/world_entities/weapons/aim.h

    r6637 r6724  
    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.
  • trunk/src/world_entities/weapons/aiming_turret.cc

    r6671 r6724  
    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
  • trunk/src/world_entities/weapons/targeting_turret.cc

    r6695 r6724  
    9494  this->target->setVisibility(false);
    9595  this->target->setRange(100);
    96   this->target->setAngle(M_PI_4/2);
     96  this->target->setAngle(M_PI_4/16);
    9797  this->lockedTime = 0;
    9898  this->neededLockTime = 2;
     
    148148            /*target->getAbsCoor() - this->getAbsCoor()*/)*.5);//this->getVelocity());
    149149
    150   pj->setTarget(this->target->getParent());
     150  pj->setTarget(lockedTarget);
    151151  pj->setParent(PNode::getNullParent());
    152152  pj->setAbsCoor(this->getEmissionPoint());
    153153  pj->setAbsDir(this->getAbsDir());
    154154  pj->activate();
    155   this->target->searchTarget();
     155 
    156156}
    157157
  • trunk/src/world_entities/weapons/turret.cc

    r6671 r6724  
    116116void Turret::tick(float dt)
    117117{
    118 /*
     118
    119119  Quaternion quat;
    120   Vector direction = this->getAbsCoor();/*this->getWeaponManager()->getFixedTarget()->getAbsCoor() - this->getAbsCoor();
     120  Vector direction = this->getAbsCoor();/*this->getWeaponManager()->getFixedTarget()->getAbsCoor() - this->getAbsCoor();*/
    121121
    122122  direction.normalize();
     
    127127    quat = Quaternion(direction, Vector(0,1,0)) * Quaternion ( -M_PI_2, Vector(0,1,0)) ;
    128128
    129   this->setAbsDirSoft(quat, 5);*/
     129  this->setAbsDirSoft(quat, 5);
    130130}
    131131
Note: See TracChangeset for help on using the changeset viewer.