Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jul 27, 2006, 6:45:58 PM (19 years ago)
Author:
bensch
Message:

orxonox/proxy: the rockets from the targeting turrets aquire targets as they are supposed, but they do not get fired unless the player is near of them… strangely

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/proxy/src/world_entities/weapons/aim.cc

    r9406 r9516  
    5050Aim::~Aim ()
    5151{
    52   if (this->material)
    53     delete this->material;
    54 
    5552/*  if (this->text != NULL)
    5653    delete this->text;*/
     
    7067
    7168  this->setBindNode(this);
    72   this->material = new Material;
    7369  this->source = NULL;
    7470
    7571  this->range = 10000;
    7672  this->angle = M_PI_4;
    77   this->group = OM_GROUP_01;
     73  this->targetGroup = OM_GROUP_02_PROJ;
    7874  this->anim = new tAnimation<Aim>(this, &Aim::setSize);
    7975  this->anim->setInfinity(ANIM_INF_CONSTANT);
     
    10399  LoadParam(root, "rotation-speed", this, Aim, setRotationSpeed)
    104100      .describe("the Speed with which the Aim should rotate");
     101
     102  LoadParam(root, "target-group", this, Aim, setTargetGroupS);
    105103}
    106104
     
    108106{
    109107  ObjectManager::EntityList::iterator entity;
    110 
    111   for (entity = State::getObjectManager()->getObjectList(group).begin();
    112        entity != State::getObjectManager()->getObjectList(group).end();
     108  //printf("%d\n", this->targetGroup);
     109
     110  for (entity = State::getObjectManager()->getObjectList(this->targetGroup).begin();
     111       entity != State::getObjectManager()->getObjectList(this->targetGroup).end();
    113112       entity ++)
    114113  {
    115114    diffVec = ( (*entity)->getAbsCoor() - this->source->getAbsCoor() );
    116115
    117     if ( diffVec.len() < range &&  acos( (this->source->getAbsDirX()).dot(diffVec)/(diffVec.len() * (this->source->getAbsDirX()).len() ) )  < angle)
     116    if ( diffVec.len() < range )//&&  acos( (this->source->getAbsDirX()).dot(diffVec)/(diffVec.len() * (this->source->getAbsDirX()).len() ) )  < angle)
    118117    {
    119118      //if (this->getParent() != (*entity))
    120119      {
     120        printf("found target::: %d %s::%s\n", (*entity)->getOMListNumber(), (*entity)->getClassCName(), (*entity)->getCName());
    121121        this->anim->replay();
    122         this->setParentSoft(*entity, 5);
     122        this->setParent/*Soft*/(*entity/*, 5 */);
    123123        return;
    124124      }
     
    128128   //if no target found:
    129129   this->setParent(PNode::getNullParent());
    130 
    131 
    132 
    133 }
    134 
     130}
     131
     132void Aim::setTargetGroupS(const std::string& groupName)
     133{
     134  printf("::::::::::::::::::::::: TEST\n");
     135  OM_LIST id = ObjectManager::StringToOMList(groupName);
     136  if (id != OM_NULL)
     137    this->setTargetGroup(id);
     138  else
     139    PRINTF(2)("List %s not found for targetting\n", groupName.c_str());
     140
     141  printf("targetGroup: %s, %d", groupName.c_str(), id);
     142}
    135143
    136144/**
     
    149157void Aim::setTexture(const std::string& textureFile)
    150158{
    151   this->material->setDiffuseMap(textureFile);
     159  this->material.setDiffuseMap(textureFile);
    152160}
    153161
     
    170178//only look for target if the aim hasn`t locked a target yet or if the actual target is out of range
    171179   if(this->getParent() == PNode::getNullParent() ||
    172       diffVec.len() > range ||
    173      ( acos( (this->source->getAbsDirX()).dot(diffVec)/(diffVec.len() * (this->source->getAbsDirX()).len() ) ) > angle))
     180      diffVec.len() > range )// ||
     181     //( acos( (this->source->getAbsDirX()).dot(diffVec)/(diffVec.len() * (this->source->getAbsDirX()).len() ) ) > angle))
    174182    {
    175183     this->setParentSoft(PNode::getNullParent(),5);
     
    213221
    214222  glRotatef(this->getAbsDir2D(), 0,0,1);
    215   this->material->select();
     223  this->material.select();
    216224  glBegin(GL_TRIANGLE_STRIP);
    217225  glTexCoord2f(0, 0);
Note: See TracChangeset for help on using the changeset viewer.