Changeset 10098 in orxonox.OLD for branches/playability
- Timestamp:
- Dec 19, 2006, 4:08:04 PM (18 years ago)
- Location:
- branches/playability/src/world_entities
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/playability/src/world_entities/particles/emitter_node.cc
r10078 r10098 73 73 74 74 this->lifeCycle += dt/this->lifeSpan; 75 if ( unlikely(this->lifeCycle >= 1))75 if (this->lifeCycle >= 1) 76 76 { 77 77 this->removeNode(); 78 this->hide(); 79 this->system->removeEmitter(this->emitter); 80 this->emitter->stop(); 81 this->emitter->setSystem(NULL); 82 this->started = false; 78 83 } 79 84 PRINTF(0)("Coordinate Update EmitterNode: (%f,%f,%f) -> (%f,%f,%f)\n",this->getAbsCoor().x,this->getAbsCoor().y,this->getAbsCoor().z,this->velocity.x,this->velocity.y,this->velocity.z); -
branches/playability/src/world_entities/particles/emitter_node.h
r10078 r10098 8 8 #define _EMITTER_NODE_H 9 9 10 #include " p_node.h"10 #include "world_entity.h" 11 11 #include "dot_emitter.h" 12 #include "particle_system.h" 12 13 13 14 // FORWARD DECLARATION … … 17 18 18 19 //! A class to handle an Emitter. 19 class EmitterNode : public PNode20 class EmitterNode : public WorldEntity 20 21 { 21 22 ObjectListDeclaration(EmitterNode); … … 31 32 inline void setVelocity(Vector velocity) { this->velocity = velocity;}; 32 33 33 inline void setupParticle(DotEmitter* emitter, ParticleSystem* system) { this->emitter = emitter; this->system = system; } ;34 inline void setupParticle(DotEmitter* emitter, ParticleSystem* system) { this->emitter = emitter; this->system = system; this->system->setLifeSpan(this->lifeSpan);} ; 34 35 void setLifetime( float lifeTime) { this->lifeSpan = lifeTime;}; 35 36 -
branches/playability/src/world_entities/projectiles/mbolt.cc
r10095 r10098 144 144 void MBolt::collidesWith(WorldEntity* entity, const Vector& location) 145 145 { 146 PRINTF( 5)("MBolt collides pretest\n");146 PRINTF(0)("MBolt collides pretest\n"); 147 147 if( entity == NULL) 148 148 return; -
branches/playability/src/world_entities/space_ships/space_ship.cc
r10096 r10098 141 141 // this->setRelDir(Quaternion(M_PI, Vector(1,0,0))); 142 142 this->registerObject(this, SpaceShip::_objectList); 143 this->toList(OM_GROUP_00);144 143 PRINTF(4)("SPACESHIP INIT\n"); 145 144 146 145 //weapons: 147 /*146 148 147 Weapon* wpRight1 = new LightBlaster (); 149 148 wpRight1->setName( "LightBlaster"); … … 151 150 Weapon* wpLeft1 = new LightBlaster (); 152 151 wpLeft1->setName( "LightBlaster"); 153 wpLeft1->setParent( this); */152 wpLeft1->setParent( this); 154 153 155 154 Weapon* wpRight2 = new MediumBlaster (); … … 159 158 wpLeft2->setName( "MediumBlaster"); 160 159 wpLeft2->setParent( this); 161 /*160 162 161 Weapon* wpRight3 = new HeavyBlaster (); 163 162 wpRight3->setName( "HeavyBlaster"); … … 165 164 Weapon* wpLeft3 = new HeavyBlaster (); 166 165 wpLeft3->setName( "HeavyBlaster"); 167 wpLeft3->setParent( this); */166 wpLeft3->setParent( this); 168 167 169 168 Weapon* cannon = new SwarmLauncher(); … … 172 171 173 172 174 //this->weaponMan.addWeapon( wpLeft1, 0, 0);175 //this->weaponMan.addWeapon( wpRight1, 0, 1);173 this->weaponMan.addWeapon( wpLeft1, 0, 0); 174 this->weaponMan.addWeapon( wpRight1, 0, 1); 176 175 this->weaponMan.addWeapon( wpLeft2, 0, 2); 177 176 this->weaponMan.addWeapon( wpRight2, 0, 3); 178 //this->weaponMan.addWeapon( wpLeft3, 0, 4);179 //this->weaponMan.addWeapon( wpRight3, 0, 5);177 this->weaponMan.addWeapon( wpLeft3, 0, 4); 178 this->weaponMan.addWeapon( wpRight3, 0, 5); 180 179 181 180 this->secWeaponMan.addWeapon( cannon, 1, 0); … … 184 183 this->secWeaponMan.changeWeaponConfig(1); 185 184 186 //wpRight1->requestAction(WA_ACTIVATE);187 //wpLeft1->requestAction(WA_ACTIVATE);185 wpRight1->requestAction(WA_ACTIVATE); 186 wpLeft1->requestAction(WA_ACTIVATE); 188 187 wpRight2->requestAction(WA_ACTIVATE); 189 188 wpLeft2->requestAction(WA_ACTIVATE); 190 //wpRight3->requestAction(WA_ACTIVATE);191 //wpLeft3->requestAction(WA_ACTIVATE);189 wpRight3->requestAction(WA_ACTIVATE); 190 wpLeft3->requestAction(WA_ACTIVATE); 192 191 193 192 cannon->requestAction(WA_ACTIVATE); … … 328 327 329 328 330 this->trail = new Trail( 3, 3, .2, this);329 this->trail = new Trail( 10, 10, .2, this); 331 330 //this->trail->setParent( this); 332 331 this->trail->setTexture( "maps/engine.png"); 333 332 334 this->trailL = new Trail( 3, 3, .2, this);333 this->trailL = new Trail( 10, 10, .2, this); 335 334 //this->trailL->setParent( this); 336 335 this->trailL->setTexture( "maps/engine.png"); 337 336 338 this->trailR = new Trail( 3, 3, .2, this);337 this->trailR = new Trail( 10, 10, .2, this); 339 338 //this->trailR->setParent( this); 340 339 this->trailR->setTexture( "maps/engine.png"); 340 341 342 this->toList(OM_GROUP_00); 341 343 } 342 344 … … 374 376 this->secWeaponMan.showCrosshair(); 375 377 this->toList( OM_GROUP_01 ); 378 /* 376 379 for(ObjectList<PNode>::const_iterator it = this->getNodesChildren().begin(); it != this->getNodesChildren().end(); it++) 377 380 { 378 381 if( likely( dynamic_cast<Weapon*>(*it) != NULL)) 379 dynamic_cast<WorldEntity*>(*it)->toList( OM_GROUP_0 0_PROJ);380 } 382 dynamic_cast<WorldEntity*>(*it)->toList( OM_GROUP_01); 383 }*/ 381 384 //dynamic_cast<Element2D*>(this->secWeaponMan.getFixedTarget())->setVisibility( true); 382 385 //this->attachCamera(); … … 388 391 this->secWeaponMan.hideCrosshair(); 389 392 this->toList( OM_GROUP_00); 393 /* 390 394 for(ObjectList<PNode>::const_iterator it = this->getNodesChildren().begin(); it != this->getNodesChildren().end(); it++) 391 395 { 392 396 if( likely( dynamic_cast<Weapon*>(*it) != NULL)) 393 dynamic_cast<WorldEntity*>(*it)->toList( OM_GROUP_0 1_PROJ);394 } 397 dynamic_cast<WorldEntity*>(*it)->toList( OM_GROUP_00); 398 }*/ 395 399 //dynamic_cast<Element2D*>(this->secWeaponMan.getFixedTarget())->setVisibility( false); 396 400 //this->detachCamera(); … … 593 597 explosionParticles->setRadius(.5, 6.0); 594 598 explosionParticles->setRadius(1.0, 3.0); 595 explosionParticles->setColor(0.0, 1,1, 0,.9);596 explosionParticles->setColor(0. 5, .8,.8,0,.5);597 explosionParticles->setColor( 1.0, .8,.8,.7,.0);598 599 600 emitter = new DotEmitter( 200, 0, 0);601 emitter ->setSpread( M_PI, M_PI);602 emitter->setSpread( 50);603 emitter->setEmissionRate( 50.0);604 emitter->setEmissionVelocity( 150.0);599 explosionParticles->setColor(0.0, 1,1,1,.9); 600 explosionParticles->setColor(0.1, 1,1,0,.9); 601 explosionParticles->setColor(0.5, .8,.4,0,.5); 602 explosionParticles->setColor(1.0, .2,.2,.2,.0); 603 604 605 emitter = new DotEmitter( 200, 200, M_2_PI); 606 emitter->setSpread( 0, M_2_PI); 607 emitter->setEmissionRate( 400.0); 608 //emitter->setEmissionVelocity( 200.0); 605 609 emitter->setSystem( explosionParticles); 606 610 emitter->setAbsCoor( this->getAbsCoor()); … … 618 622 */ 619 623 this->setAbsCoor(Vector(-10000,10000,10000)); 620 this->hide();624 //this->hide(); 621 625 622 626 this->toList( OM_DEAD); 623 for(ObjectList<PNode>::const_iterator it = this->getNodesChildren().begin(); it != this->getNodesChildren().end(); it++) 624 { 625 if( likely( dynamic_cast<Weapon*>(*it) != NULL)) 626 dynamic_cast<WorldEntity*>(*it)->toList( OM_DEAD); 627 } 628 PRINTF(0)("spaceship destroy == ship translated \n"); 627 PRINTF(0)("spaceship destroy == ship translated \n"); 629 628 } 630 629 631 630 void SpaceShip::respawn( ) 632 631 { 633 this->unhide();632 //this->unhide(); 634 633 /*for(ObjectList<PNode>::const_iterator it = this->getNodesChildren().begin(); it != this->getNodesChildren().end(); it++) 635 634 { … … 637 636 dynamic_cast<WorldEntity*>(*it)->toList( OM_GROUP_00); 638 637 }*/ 638 /* 639 639 if( this->hasPlayer()) 640 640 { … … 654 654 dynamic_cast<WorldEntity*>(*it)->toList( OM_GROUP_01_PROJ); 655 655 } 656 } 656 }*/ 657 657 658 658 } … … 766 766 this->travelNode->updateNode(0.01f); 767 767 768 //this->setParent(this->travelNode);768 this->setParent(this->travelNode); 769 769 this->setRelCoor(0,0,0); 770 770 771 //State::getCameraNode()->setParentSoft(this->travelNode);772 State::getCameraNode()->setParentSoft(this);771 State::getCameraNode()->setParentSoft(this->travelNode); 772 //State::getCameraNode()->setParentSoft(this); 773 773 State::getCameraNode()->setRelCoorSoft(-0.01, 40, 0); 774 //State::getCameraTargetNode()->setParentSoft(this->travelNode);775 State::getCameraTargetNode()->setParentSoft(this);774 State::getCameraTargetNode()->setParentSoft(this->travelNode); 775 //State::getCameraTargetNode()->setParentSoft(this); 776 776 State::getCameraTargetNode()->setRelCoorSoft(0,0,0); 777 777 … … 797 797 float airCoeff = 2.5; 798 798 float pi = 3.14; 799 800 Vector tempVelocity; 799 801 800 802 801 switch(this->getPlaymode()) … … 806 805 // these routines will change the travel movement into zero in a short amout of time, if the player 807 806 // doesn't press any buttons. 808 if (t empVelocity.x >= 0)809 { 810 if (t empVelocity.x > airCoeff*this->acceleration * dt)811 t empVelocity.x -= airCoeff* this->acceleration * dt;807 if (this->travelVelocity.x >= 0) 808 { 809 if (this->travelVelocity.x > airCoeff*this->acceleration * dt) 810 this->travelVelocity.x -= airCoeff* this->acceleration * dt; 812 811 else 813 t empVelocity.x = 0;812 this->travelVelocity.x = 0; 814 813 } 815 814 else 816 815 { 817 if (t empVelocity.x < -airCoeff*this->acceleration * dt)818 t empVelocity.x += airCoeff* this->acceleration * dt;816 if (this->travelVelocity.x < -airCoeff*this->acceleration * dt) 817 this->travelVelocity.x += airCoeff* this->acceleration * dt; 819 818 else 820 t empVelocity.x = 0;821 } 822 if (t empVelocity.z >= 0)823 { 824 if (t empVelocity.z > airCoeff*this->acceleration * dt)825 t empVelocity.z -= airCoeff* this->acceleration * dt;819 this->travelVelocity.x = 0; 820 } 821 if (this->travelVelocity.z >= 0) 822 { 823 if (this->travelVelocity.z > airCoeff*this->acceleration * dt) 824 this->travelVelocity.z -= airCoeff* this->acceleration * dt; 826 825 else 827 t empVelocity.z = 0;826 this->travelVelocity.z = 0; 828 827 } 829 828 else 830 829 { 831 if (t empVelocity.z < -airCoeff*this->acceleration * dt)832 t empVelocity.z += airCoeff* this->acceleration * dt;830 if (this->travelVelocity.z < -airCoeff*this->acceleration * dt) 831 this->travelVelocity.z += airCoeff* this->acceleration * dt; 833 832 else 834 t empVelocity.z = 0;833 this->travelVelocity.z = 0; 835 834 } 836 835 … … 850 849 if(this->getRelCoor().x < this->travelDistancePlus.x) 851 850 { 852 if (t empVelocity.x < this->travelSpeed)851 if (this->travelVelocity.x < this->travelSpeed) 853 852 { 854 t empVelocity.x += (airCoeff + 1.0)*this->acceleration*dt;853 this->travelVelocity.x += (airCoeff + 1.0)*this->acceleration*dt; 855 854 } 856 855 else 857 856 { 858 t empVelocity.x = this->travelSpeed;857 this->travelVelocity.x = this->travelSpeed; 859 858 } 860 859 } 861 860 else 862 861 { 863 t empVelocity.x = 0.0f;862 this->travelVelocity.x = 0.0f; 864 863 } 865 864 } … … 869 868 if(this->getRelCoor().x > this->travelDistanceMinus.x) 870 869 { 871 if (t empVelocity.x > -this->travelSpeed)870 if (this->travelVelocity.x > -this->travelSpeed) 872 871 { 873 t empVelocity.x -= (airCoeff + 1.0)*this->acceleration*dt;872 this->travelVelocity.x -= (airCoeff + 1.0)*this->acceleration*dt; 874 873 } 875 874 else 876 875 { 877 t empVelocity.x = -this->travelSpeed;876 this->travelVelocity.x = -this->travelSpeed; 878 877 } 879 878 } 880 879 else 881 880 { 882 t empVelocity.x = 0.0f;881 this->travelVelocity.x = 0.0f; 883 882 } 884 883 } … … 888 887 if(this->getRelCoor().z > this->travelDistanceMinus.y) 889 888 { 890 if (t empVelocity.z > -this->travelSpeed)889 if (this->travelVelocity.z > -this->travelSpeed) 891 890 { 892 t empVelocity.z -= (airCoeff + 1.0)*this->acceleration*dt;891 this->travelVelocity.z -= (airCoeff + 1.0)*this->acceleration*dt; 893 892 } 894 893 else 895 894 { 896 t empVelocity.z = -this->travelSpeed;895 this->travelVelocity.z = -this->travelSpeed; 897 896 } 898 897 } 899 898 else 900 899 { 901 t empVelocity.z = 0.0f;900 this->travelVelocity.z = 0.0f; 902 901 } 903 902 this->setRelDirSoft(Quaternion(-pi/6, Vector(1,0,0)), 6); … … 908 907 if(this->getRelCoor().z < this->travelDistancePlus.y) 909 908 { 910 if (t empVelocity.z < this->travelSpeed)909 if (this->travelVelocity.z < this->travelSpeed) 911 910 { 912 t empVelocity.z += (airCoeff + 1.0)*this->acceleration*dt;911 this->travelVelocity.z += (airCoeff + 1.0)*this->acceleration*dt; 913 912 } 914 913 else 915 914 { 916 t empVelocity.z = this->travelSpeed;915 this->travelVelocity.z = this->travelSpeed; 917 916 } 918 917 } 919 918 else 920 919 { 921 t empVelocity.z = 0.0f;920 this->travelVelocity.z = 0.0f; 922 921 } 923 922 this->setRelDirSoft(Quaternion(pi/6, Vector(1,0,0)), 6); … … 930 929 931 930 this->travelNode->shiftCoor(Vector(this->cameraSpeed * dt, 0, 0)); 932 this->shiftCoor (t empVelocity * dt);931 this->shiftCoor (this->travelVelocity * dt); 933 932 934 933 //normalisation of the vectors (vector sum must be <= travelspeed) 935 float xzNorm = sqrt(pow(t empVelocity.x, 2) + pow(tempVelocity.z, 2));934 float xzNorm = sqrt(pow(this->travelVelocity.x, 2) + pow(this->travelVelocity.z, 2)); 936 935 if (xzNorm > this->travelSpeed) 937 936 { 938 t empVelocity.x = tempVelocity.x/xzNorm * this->travelSpeed;939 t empVelocity.z = tempVelocity.z/xzNorm * this->travelSpeed;937 this->travelVelocity.x = this->travelVelocity.x/xzNorm * this->travelSpeed; 938 this->travelVelocity.z = this->travelVelocity.z/xzNorm * this->travelSpeed; 940 939 } 941 940 … … 944 943 945 944 //set new coordinates calculated through key- events. 946 this->shiftCoor (t empVelocity * dt);945 this->shiftCoor (this->travelVelocity * dt); 947 946 break; 948 947 } … … 956 955 /* 957 956 this->travelNode->shiftCoor(Vector(this->cameraSpeed * dt, 0, 0)); 958 this->shiftCoor (t empVelocity * dt);959 960 float angle = t empVelocity.z / travelSpeed * pi / 3;957 this->shiftCoor (this->travelVelocity * dt); 958 959 float angle = this->travelVelocity.z / travelSpeed * pi / 3; 961 960 if (angle > pi/4) angle = pi/4; 962 961 if (angle < -pi/4) angle = -pi/4; -
branches/playability/src/world_entities/space_ships/space_ship.h
r10095 r10098 155 155 PNode* travelNode; 156 156 float travelSpeed; //!< the current speed of the Ship (to make soft movement) 157 Vector travelVelocity; //!< object internal velocity vector for relative movement to the track node 157 158 Vector2D travelDistancePlus; //!< Travel-Distance away from the TravelNode 158 159 Vector2D travelDistanceMinus; -
branches/playability/src/world_entities/weapons/medium_blaster.cc
r10095 r10098 96 96 pj->setParent(PNode::getNullParent()); 97 97 98 pj->setVelocity(this->getParent()->getVelocity() + this->getAbsDir().apply(Vector(1,0,0))*1 00);98 pj->setVelocity(this->getParent()->getVelocity() + this->getAbsDir().apply(Vector(1,0,0))*160); 99 99 100 100 pj->setAbsCoor(this->getEmissionPoint());
Note: See TracChangeset
for help on using the changeset viewer.