Changeset 3752 in orxonox.OLD for orxonox/trunk/src/world_entities
- Timestamp:
- Apr 7, 2005, 10:13:42 PM (20 years ago)
- Location:
- orxonox/trunk/src/world_entities
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/src/world_entities/player.cc
r3750 r3752 53 53 acceleration = 10.0; 54 54 //weapons: 55 Weapon* wp = new TestGun(this, new Vector(- 1.1, 0.0, 2.6), new Quaternion());55 Weapon* wp = new TestGun(this, new Vector(-2.6, 0.1, 3.0), new Quaternion()); 56 56 this->weapons->add(wp); 57 57 this->activeWeapon = wp; -
orxonox/trunk/src/world_entities/test_gun.cc
r3751 r3752 30 30 #include "vector.h" 31 31 #include "list.h" 32 #include "simple_animation.h" 32 33 33 34 using namespace std; … … 42 43 : Weapon (parent, coordinate, direction) 43 44 { 44 //this->model = (Model*)ResourceManager::getInstance()->load("models/weapon_packet.obj", OBJ, RP_CAMPAIGN);45 this->model = (Model*)ResourceManager::getInstance()->load("models/test_gun.obj", OBJ, RP_CAMPAIGN); 45 46 this->idleTime = 0.2f; 47 48 this->animator = SimpleAnimation::getInstance(); 49 this->dummy = new WorldEntity(); /* a world entity that is not drawed: use this for the weapon */ 50 parent->addChild(this->dummy, PNODE_ALL); 51 //this->dummy->setRelCoor(new Vector(-2.6, 0.1, 3.0)); 52 53 this->animator->animatorBegin(); 54 this->animator->selectObject(this->dummy); 55 this->animator->setAnimationMode(SINGLE); 56 this->animator->addKeyFrame(new Vector(-2.6, 0.1, 3.0), new Quaternion(), 0.0, NEG_EXP); 57 this->animator->addKeyFrame(new Vector(-3.0, 0.1, 3.0), new Quaternion(), 0.1, NEG_EXP); 58 this->animator->addKeyFrame(new Vector(-2.6, 0.1, 3.0), new Quaternion(), 0.5, NEG_EXP); 59 this->animator->animatorEnd(); 60 46 61 } 47 62 … … 100 115 this->worldEntities->add(pj); 101 116 this->localTime = 0; 117 118 this->animator->animatorBegin(); 119 this->animator->selectObject(this->dummy); 120 this->animator->start(); 121 this->animator->animatorEnd(); 102 122 } 103 123 … … 131 151 { 132 152 this->localTime += time; 133 //this->debug();134 //printf("TEST_GUN: this speed is: %f\n", this->getSpeed());135 153 } 136 154 … … 148 166 void TestGun::draw () 149 167 { 168 150 169 glMatrixMode(GL_MODELVIEW); 151 170 glPushMatrix(); 152 171 float matrix[4][4]; 153 172 154 /* translate */173 155 174 glTranslatef (this->getAbsCoor ().x, 156 175 this->getAbsCoor ().y, 157 176 this->getAbsCoor ().z); 158 /* rotate */177 159 178 this->getAbsDir ().matrix (matrix); 160 179 glMultMatrixf((float*)matrix); 180 this->model->draw(1); 181 glPopMatrix(); 161 182 162 //this->model->draw(2); 183 184 glMatrixMode(GL_MODELVIEW); 185 glPushMatrix(); 186 187 glTranslatef (this->dummy->getAbsCoor ().x, 188 this->dummy->getAbsCoor ().y, 189 this->dummy->getAbsCoor ().z); 190 191 this->dummy->getAbsDir ().matrix (matrix); 192 glMultMatrixf((float*)matrix); 193 this->model->draw(0); 163 194 glPopMatrix(); 195 164 196 } 165 197 -
orxonox/trunk/src/world_entities/test_gun.h
r3631 r3752 29 29 class Vector; 30 30 class Quaternion; 31 class SimpleAnimation; 31 32 32 33 … … 50 51 virtual void draw(void); 51 52 53 private: 54 SimpleAnimation* animator; 55 WorldEntity* dummy; 56 52 57 }; 53 58 -
orxonox/trunk/src/world_entities/weapon.cc
r3685 r3752 37 37 : WorldEntity() 38 38 { 39 parent->addChild(this, PNODE_ ROTATE_AND_MOVE);39 parent->addChild(this, PNODE_ALL); 40 40 this->setRelCoor(coordinate); 41 41 this->setRelDir(direction);
Note: See TracChangeset
for help on using the changeset viewer.