Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 10786


Ignore:
Timestamp:
Nov 9, 2015, 3:51:17 PM (8 years ago)
Author:
vaydin
Message:

added ability to attach second particle effect to explosionpart, added ability to define range of velocity of explosionpart

Location:
code/branches/explosionChunksHS15
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • code/branches/explosionChunksHS15/data/levels/emptyLevel.oxw

    r10752 r10786  
    3434        team                = "1"
    3535        position            = "1000,0,0"
    36    explosionchunks        = 60
    3736        >
    3837        <templates>
    39                       <Template link=spaceshipassff />
     38          <Template link=spaceshipassff />
    4039        </templates>
     40
     41        <explosion >
     42          <ExplosionPart minspeed=0 maxspeed=0 effect1="orxonox/explosion_flash2" effect2="orxonox/explosion_flame2" />
     43          <ExplosionPart minspeed=0 maxspeed=0 effect1="orxonox/explosion_shockwave2" effect2="orxonox/explosion_sparks2" />
     44          <ExplosionPart minspeed=0 maxspeed=0 effect1="orxonox/explosion_streak2" effect2="orxonox/explosion_afterglow" />
     45        </explosion>
    4146         
    4247                   
     
    4752        >
    4853        <templates>
    49                       <Template link=spaceshipassff />
    50                     </templates>
    51                     <explosion>
     54          <Template link=spaceshipassff />
     55        </templates>
    5256
    53           <ExplosionPart mesh="ship.mesh" effect="Orxonox/smoke7" />
    54           <ExplosionPart mesh="ship.mesh" effect="Orxonox/smoke7" />
     57        <explosion >
     58          <ExplosionPart minspeed=0 maxspeed=0 effect1="orxonox/explosion_flash2" effect2="orxonox/explosion_flame2" />
     59          <ExplosionPart minspeed=0 maxspeed=0 effect1="orxonox/explosion_shockwave2" effect2="orxonox/explosion_sparks2" />
     60          <ExplosionPart minspeed=0 maxspeed=0 effect1="orxonox/explosion_streak2" effect2="orxonox/explosion_afterglow" />
    5561
     62          <ExplosionPart minspeed=0 maxspeed=0 effect1="Orxonox/explosion2b" effect2="Orxonox/smoke6" />
     63          <ExplosionPart mesh="CockpitDebris.mesh" effect1="Orxonox/fire4" effect2="Orxonox/smoke6" />
     64          <ExplosionPart mesh="BodyDebris1.mesh" effect1="Orxonox/fire4" effect2="Orxonox/smoke6" />
     65          <ExplosionPart mesh="WingDebris1.mesh" effect1="Orxonox/fire4" effect2="Orxonox/smoke6" />
     66          <ExplosionPart mesh="WingDebris2.mesh" effect1="Orxonox/fire4" effect2="Orxonox/smoke6" />
     67          <ExplosionPart mesh="CockpitDebris.mesh" effect1="Orxonox/fire4" effect2="Orxonox/smoke6" />
     68          <ExplosionPart mesh="BodyDebris1.mesh" effect1="Orxonox/fire4" effect2="Orxonox/smoke6" />
     69          <ExplosionPart mesh="WingDebris1.mesh" effect1="Orxonox/fire4" effect2="Orxonox/smoke6" />
     70          <ExplosionPart mesh="WingDebris2.mesh" effect1="Orxonox/fire4" effect2="Orxonox/smoke6" />
    5671        </explosion>
    5772                   
     
    6277        >
    6378        <templates>
    64                       <Template link=spaceshipassff />
    65                     </templates>
    66                     <explosion>
     79          <Template link=spaceshipassff />
     80        </templates>
    6781
    68           <ExplosionPart mesh="ship.mesh" effect="Orxonox/smoke7" />
    69           <ExplosionPart mesh="ship.mesh" effect="Orxonox/smoke7" />
     82        <explosion>
     83         
     84        </explosion>
    7085
    71         </explosion>
     86       
    7287                   
    7388    </SpaceShip>
  • code/branches/explosionChunksHS15/src/orxonox/worldentities/ExplosionPart.cc

    r10755 r10786  
    4343        this->LOD_ = LODParticle::Normal;
    4444                this->mesh_ = "";
    45                 this->effect_ = "";
     45                this->effect1_ = "";
     46                this->effect2_ = "";
    4647                this->model_= new Model(this->getContext());
    47                 this->particleInterface_= NULL;
     48                this->effect1Particle_= NULL;
     49                this->effect2Particle_= NULL;
    4850                this->explosionEntity_ = new MovableEntity(this->getContext());
    4951
     
    5355
    5456
     57        ExplosionPart::~ExplosionPart()
     58    {
     59        if (this->isInitialized())
     60        {
     61            if (this->effect1Particle_)
     62            {
     63                this->model_->detachOgreObject(this->effect1Particle_->getParticleSystem());
     64                delete this->effect1Particle_;
     65            }
     66            if (this->effect2Particle_)
     67            {
     68                this->model_->detachOgreObject(this->effect2Particle_->getParticleSystem());
     69                delete this->effect2Particle_;
     70            }
     71        }
     72    }
     73
     74
    5575        void ExplosionPart::XMLPort(Element& xmlelement, XMLPort::Mode mode)
    5676        {
    5777                SUPER(ExplosionPart, XMLPort, xmlelement, mode);
    5878
    59                 XMLPortParam(ExplosionPart, "mesh", setMesh, getMesh, xmlelement, mode);
    60                 XMLPortParam(ExplosionPart, "effect", setEffect, getEffect, xmlelement, mode);
     79                XMLPortParam(ExplosionPart, "mesh", setMesh, getMesh, xmlelement, mode).defaultValues("");
     80                XMLPortParam(ExplosionPart, "minspeed", setMinSpeed, getMinSpeed, xmlelement, mode).defaultValues(50);
     81                XMLPortParam(ExplosionPart, "maxspeed", setMaxSpeed, getMaxSpeed, xmlelement, mode).defaultValues(100);
     82                XMLPortParam(ExplosionPart, "effect1", setEffect1, getEffect1, xmlelement, mode).defaultValues("");
     83                XMLPortParam(ExplosionPart, "effect2", setEffect2, getEffect2, xmlelement, mode).defaultValues("");
    6184
    6285
     
    6891                orxout() << "Explode" << endl;
    6992
    70                 orxout() << getMesh() << endl;
    71                 orxout() << getEffect() << endl;
    7293
    7394                this->model_->setVisible(true);
     
    7798                //this->model_->setSyncMode(0);
    7899
    79                 this->particleInterface_ = new ParticleInterface(this->getScene()->getSceneManager(), effect_, this->LOD_);
     100                if(effect1_ != "")
     101                {
     102                        this->effect1Particle_ = new ParticleInterface(this->getScene()->getSceneManager(), effect1_, this->LOD_);
     103                        this->model_->attachOgreObject(this->effect1Particle_->getParticleSystem());
     104                }
    80105
    81                 this->model_->attachOgreObject(this->particleInterface_->getParticleSystem());
     106                if(effect2_ != "")
     107                {
     108                        this->effect2Particle_ = new ParticleInterface(this->getScene()->getSceneManager(), effect2_, this->LOD_);
     109                        this->model_->attachOgreObject(this->effect2Particle_->getParticleSystem());
     110                }       
    82111
    83                
    84 
    85                 this->explosionEntity_->setVelocity(Vector3(rnd(-1, 1), rnd(-1, 1), rnd(-1, 1))*rnd(50,100));
     112                this->explosionEntity_->setVelocity(Vector3(rnd(-1, 1), rnd(-1, 1), rnd(-1, 1))*rnd(minSpeed_,maxSpeed_));
    86113        this->explosionEntity_->setAngularVelocity(Vector3(rnd(-1, 1), rnd(-1, 1), rnd(-1, 1)).normalisedCopy() * Degree(400).valueRadians());
    87114        this->explosionEntity_->setScale(4);
     
    91118        this->attach(explosionEntity_);
    92119
     120        if (GameMode::isMaster())
     121        {
     122            this->destroyTimer_.setTimer(rnd(2, 3), false, createExecutor(createFunctor(&ExplosionPart::stop, this)));
     123        }
     124
     125        }
     126
     127        void ExplosionPart::stop()
     128        {
     129                if (this->effect1Particle_)
     130            this->effect1Particle_->setEnabled(false);
     131        if (this->effect2Particle_)
     132            this->effect2Particle_->setEnabled(false);
     133        if (this->model_)
     134            this->model_->setVisible(false);
     135
     136        if (GameMode::isMaster())
     137        {
     138            this->bStop_ = true;
     139            this->destroyTimer_.setTimer(1.0f, false, createExecutor(createFunctor(&ExplosionPart::destroy, this)));
     140        }
    93141        }
    94142
     
    98146        void ExplosionPart::setMesh(const std::string& newString)
    99147        {
    100                 this->mesh_ = newString;
    101                 this->model_->setMeshSource(mesh_);
    102                 this->model_->setVisible(false);
    103                 orxout() << newString << endl;
     148                if(newString != "")
     149                {
     150                        this->mesh_ = newString;
     151                        this->model_->setMeshSource(mesh_);
     152                        this->model_->setVisible(false);
     153                }
    104154        }
    105155
    106         void ExplosionPart::setEffect(const std::string& newString)
     156        void ExplosionPart::setEffect1(const std::string& newString)
    107157        {
    108                 this->effect_ = newString;
     158                this->effect1_ = newString;
     159        }
     160
     161        void ExplosionPart::setEffect2(const std::string& newString)
     162        {
     163                this->effect2_ = newString;
     164        }
     165
     166        void ExplosionPart::setMinSpeed(float speed)
     167        {
     168                this->minSpeed_ = speed;
     169        }
     170
     171        void ExplosionPart::setMaxSpeed(float speed)
     172        {
     173                this->maxSpeed_ = speed;
    109174        }
    110175
     
    112177        { return this->mesh_; }
    113178
    114         std::string& ExplosionPart::getEffect()
    115         { return this->effect_; }
     179        std::string& ExplosionPart::getEffect1()
     180        { return this->effect1_; }
     181
     182        std::string& ExplosionPart::getEffect2()
     183        { return this->effect2_; }
     184
     185        float ExplosionPart::getMinSpeed()
     186        {
     187                return this->minSpeed_;
     188        }
     189
     190        float ExplosionPart::getMaxSpeed()
     191        {
     192                return this->maxSpeed_;
     193        }
     194
    116195
    117196
  • code/branches/explosionChunksHS15/src/orxonox/worldentities/ExplosionPart.h

    r10752 r10786  
    4141#include "core/command/Executor.h"
    4242#include "Scene.h"
     43#include "tools/Timer.h"
    4344
    4445
     
    4950        public:
    5051            ExplosionPart(Context* context);
     52            ~ExplosionPart();
    5153            void XMLPort(Element& xmlelement, XMLPort::Mode mode);
    5254            void Explode();
     55            void stop();
    5356
    5457            void setMesh(const std::string& newString);
    5558            std::string& getMesh();
    56             void setEffect(const std::string& newString);
    57             std::string& getEffect();
     59            void setEffect1(const std::string& newString);
     60            std::string& getEffect1();
     61            void setEffect2(const std::string& newString);
     62            std::string& getEffect2();
     63            void setMinSpeed(float speed);
     64            float getMinSpeed();
     65            void setMaxSpeed(float speed);
     66            float getMaxSpeed();
    5867         
    5968
     
    6574
    6675                Model* model_;
    67                 ParticleInterface* particleInterface_;
     76                ParticleInterface* effect1Particle_;
     77            ParticleInterface* effect2Particle_;
    6878
     79
     80            float minSpeed_;
     81            float maxSpeed_;
    6982                std::string mesh_;
    70                 std::string effect_;
     83                std::string effect1_;
     84            std::string effect2_;
    7185
    7286            MovableEntity* explosionEntity_;
     87
     88            Timer destroyTimer_;
    7389
    7490               
  • code/branches/explosionChunksHS15/src/orxonox/worldentities/pawns/Pawn.cc

    r10755 r10786  
    374374            if (GameMode::isMaster())
    375375            {
    376                 this->deatheffect();
     376                //this->deatheffect();
    377377                this->goWithStyle();
    378378            }
Note: See TracChangeset for help on using the changeset viewer.