Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Sep 26, 2008, 12:59:48 AM (16 years ago)
Author:
scheusso
Message:

Fix in Projectiles (network fix)
different improvements in synchronisable and gamestates

Location:
code/branches/network/src/orxonox/objects
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • code/branches/network/src/orxonox/objects/BillboardProjectile.cc

    r1747 r1834  
    4242        RegisterObject(BillboardProjectile);
    4343
    44         if (this->owner_)
    45         {
    46             this->billboard_.setBillboardSet("Examples/Flare", ColourValue(1.0, 1.0, 0.5), 1);
    47             this->attachObject(this->billboard_.getBillboardSet());
    48             this->scale(0.5);
    49         }
     44        this->billboard_.setBillboardSet("Examples/Flare", ColourValue(1.0, 1.0, 0.5), 1);
     45        this->attachObject(this->billboard_.getBillboardSet());
     46        this->scale(0.5);
    5047    }
    5148
  • code/branches/network/src/orxonox/objects/ParticleProjectile.cc

    r1747 r1834  
    4242        RegisterObject(ParticleProjectile);
    4343
     44        this->particles_ = new ParticleInterface("Orxonox/shot2", LODParticle::normal);
     45        this->particles_->addToSceneNode(this->getNode());
     46        this->particles_->setKeepParticlesInLocalSpace(true);
    4447        if (this->owner_)
    4548        {
    46             this->particles_ = new ParticleInterface("Orxonox/shot2", LODParticle::normal);
    47             this->particles_->addToSceneNode(this->getNode());
    48             this->particles_->getAllEmitters()->setDirection(-this->owner_->getInitialDir());
    49             this->particles_->setKeepParticlesInLocalSpace(true);
    5049        }
    51         else
    52         {
    53             this->particles_ = 0;
    54         }
     50//        else
     51//        {
     52//            this->particles_ = 0;
     53//        }
    5554
    5655        this->setConfigValues();
     
    7372        this->particles_->setEnabled(this->isVisible());
    7473    }
     74   
     75    bool ParticleProjectile::create(){
     76      if(!Projectile::create())
     77        return false;
     78      this->particles_->getAllEmitters()->setDirection(-this->getOrientation()*Vector3(1,0,0));
     79      return true;
     80    }
    7581}
  • code/branches/network/src/orxonox/objects/ParticleProjectile.h

    r1747 r1834  
    4545            virtual void changedVisibility();
    4646            void setConfigValues();
     47           
     48            virtual bool create();
    4749
    4850        private:
  • code/branches/network/src/orxonox/objects/Projectile.cc

    r1747 r1834  
    5454        this->smokeTemplateName_ = "Orxonox/smoke4";
    5555
     56        this->setStatic(false);
     57        this->translate(Vector3(55, 0, 0), Ogre::Node::TS_LOCAL);
     58       
    5659        if (this->owner_)
    5760        {
    58             this->setStatic(false);
    5961            this->setOrientation(this->owner_->getOrientation());
    6062            this->setPosition(this->owner_->getPosition());
    61             this->translate(Vector3(55, 0, 0), Ogre::Node::TS_LOCAL);
    6263            this->setVelocity(this->owner_->getInitialDir() * this->speed_);
    6364        }
     
    121122        delete this;
    122123    }
     124   
     125    bool Projectile::create(){
     126      return WorldEntity::create();
     127    }
    123128}
  • code/branches/network/src/orxonox/objects/Projectile.h

    r1747 r1834  
    4545            void destroyObject();
    4646            virtual void tick(float dt);
     47           
     48            virtual bool create();
    4749
    4850            static float getSpeed()
  • code/branches/network/src/orxonox/objects/SpaceShip.cc

    r1772 r1834  
    7878      for(it = ObjectList<SpaceShip>::begin(); it; ++it){
    7979        assert(it->isA(Class(SpaceShip)));
    80         if( (it)->myShip_ || (network::Host::running() && network::Host::getShipID()==(it)->objectID) ){
     80        if( (it)->myShip_ || (network::Host::running() && network::Host::getShipID()==(it)->getObjectID()) ){
    8181//        COUT(1) << "^^^^^^^^^^ myShip_:" << *it << " classname: " << (*it)->getIdentifier()->getName() << " objectid: " << (*it)->objectID << std::endl;
    8282          return *it;
     
    173173        if(network::Host::running())
    174174//          COUT(3) << "this id: " << this->objectID << " myShipID: " << network::Host::getShipID() << std::endl;
    175         if(network::Host::running() && objectID == network::Host::getShipID()){
     175        if(network::Host::running() && getObjectID() == network::Host::getShipID()){
    176176          if(!network::Host::isServer())
    177177            setObjectMode(0x3);
     
    375375        if(this->isExactlyA(Class(SpaceShip))){
    376376          getFocus();
    377           COUT(3) << "getting focus for obj id: " << objectID << std::endl;
     377          COUT(3) << "getting focus for obj id: " << getObjectID() << std::endl;
    378378        }else
    379           COUT(3) << "not getting focus (not exactly spaceship) for obj id: " << objectID << std::endl;
     379          COUT(3) << "not getting focus (not exactly spaceship) for obj id: " << getObjectID() << std::endl;
    380380      }else
    381         COUT(3) << "not getting focus (not my ship) for obj id: " << objectID << std::endl;
     381        COUT(3) << "not getting focus (not my ship) for obj id: " << getObjectID() << std::endl;
    382382    }
    383383
     
    475475            projectile->setColour(this->getProjectileColour());
    476476            projectile->create();
    477             if (projectile->classID == 0)
     477            if (projectile->getClassID() == 0)
    478478            {
    479479              COUT(3) << "generated projectile with classid 0" <<  std::endl; // TODO: remove this output
     
    570570        }
    571571
    572         COUT(5) << "steering our ship: " << objectID << std::endl;
     572        COUT(5) << "steering our ship: " << getObjectID() << std::endl;
    573573        this->acceleration_.x = 0;
    574574        this->acceleration_.y = 0;
Note: See TracChangeset for help on using the changeset viewer.