Changeset 6803 in orxonox.OLD for trunk/src/world_entities/space_ships
- Timestamp:
- Jan 28, 2006, 11:14:40 AM (19 years ago)
- Location:
- trunk/src/world_entities/space_ships
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/world_entities/space_ships/hover.cc
r6801 r6803 34 34 35 35 CREATE_FACTORY(Hover, CL_HOVER); 36 37 /**38 * creates the controlable Hover39 */40 Hover::Hover()41 {42 this->init();43 }44 36 45 37 /** … … 91 83 this->addWeapon(wpLeft, 1, 0); 92 84 this->addWeapon(wpRight,1 ,1); 93 this->addWeapon(cannon, 0, 6); 94 95 //this->addWeapon(turret, 3, 0); 85 this->addWeapon(cannon, 0, 2); 96 86 97 87 this->getWeaponManager()->changeWeaponConfig(1); … … 134 124 135 125 // rotors 136 this->wingNodeLeft.addNodeFlags(PNODE_PROHIBIT_DELETE_WITH_PARENT); 126 this->wingNodeLeft.addNodeFlags(PNODE_PROHIBIT_DELETE_WITH_PARENT ); 127 this->wingNodeLeft.addNodeFlags(PNODE_PROHIBIT_CHILD_DELETE); 137 128 this->wingNodeLeft.setParent(this); 138 129 this->wingNodeLeft.setRelCoor(-1.5, -.3, -1.0); … … 142 133 143 134 this->wingNodeRight.addNodeFlags(PNODE_PROHIBIT_DELETE_WITH_PARENT); 135 this->wingNodeRight.addNodeFlags(PNODE_PROHIBIT_CHILD_DELETE); 144 136 this->wingNodeRight.setParent(this); 145 137 this->wingNodeRight.setRelCoor(-1.5, -0.3, 1.0); … … 148 140 this->rotorNodeRight.setRelCoor(0, 1.0, 2.3); 149 141 142 dynamic_cast<Element2D*>(this->getWeaponManager()->getFixedTarget())->setVisibility( false); 143 150 144 this->loadModel("models/ships/hoverglider_wing.obj", 1.0f, 3); 151 145 this->loadModel("models/ships/hoverglider_rotor.obj", 1.0f, 4); … … 155 149 this->velocity = Vector(0.0,0.0,0.0); 156 150 this->velocityDir = Vector(1.0,0.0,0.0); 157 // GLGuiButton* button = new GLGuiPushButton();158 // button->show();159 // button->setLabel("orxonox");160 // button->setBindNode(this);161 151 162 152 //add events to the eventlist … … 175 165 registerEvent(EV_MOUSE_MOTION); 176 166 177 this->getWeaponManager()->setSlotCount(7); 178 179 this->getWeaponManager()->setSlotPosition(0, Vector(-2.6, .1, -3.0)); 167 168 // WEAPON_MANAGER configuration 169 this->getWeaponManager()->setSlotCount(5); 170 171 this->getWeaponManager()->setSlotPosition(0, Vector(-0.28, 1.186, -2.750), &this->wingNodeLeft); 180 172 this->getWeaponManager()->setSlotCapability(0, WTYPE_ALLDIRS | WTYPE_DIRECTIONAL); 181 173 182 this->getWeaponManager()->setSlotPosition(1, Vector(- 2.6, .1, 3.0));174 this->getWeaponManager()->setSlotPosition(1, Vector(-0.28, 1.186, 2.750), &this->wingNodeRight); 183 175 this->getWeaponManager()->setSlotCapability(1, WTYPE_ALLDIRS | WTYPE_DIRECTIONAL); 184 176 185 this->getWeaponManager()->setSlotPosition(2, Vector(-1.5, .5, -.5)); 186 this->getWeaponManager()->setSlotDirection(2, Quaternion(-M_PI_4*.5, Vector(1,0,0))); 187 188 this->getWeaponManager()->setSlotPosition(3, Vector(-1.5, .5, .5)); 189 this->getWeaponManager()->setSlotDirection(3, Quaternion(M_PI_4*.5, Vector(1,0,0))); 190 191 this->getWeaponManager()->setSlotPosition(4, Vector(-1.5, -.5, .5)); 192 this->getWeaponManager()->setSlotDirection(4, Quaternion(-M_PI_4*.5+M_PI, Vector(1,0,0))); 193 194 this->getWeaponManager()->setSlotPosition(5, Vector(-1.5, -.5, -.5)); 195 this->getWeaponManager()->setSlotDirection(5, Quaternion(+M_PI_4*.5-M_PI, Vector(1,0,0))); 196 // 197 this->getWeaponManager()->setSlotPosition(6, Vector(-1, 0.0, 0)); 198 this->getWeaponManager()->setSlotCapability(6, WTYPE_ALLDIRS | WTYPE_DIRECTIONAL); 199 // 200 // this->getWeaponManager()->setSlotPosition(8, Vector(-2.5, -0.3, -2.0)); 201 // this->getWeaponManager()->setSlotDirection(8, Quaternion(-M_PI, Vector(1,0,0))); 202 // 203 // this->getWeaponManager()->setSlotPosition(9, Vector(-2.5, -0.3, 2.0)); 204 // this->getWeaponManager()->setSlotDirection(9, Quaternion(+M_PI, Vector(1,0,0)));: 177 this->getWeaponManager()->setSlotPosition(2, Vector(-1.63, .809, -.003)); 178 this->getWeaponManager()->setSlotCapability(2, WTYPE_HEAVY); 179 180 /// TODO: THESE ARE TOO MUCH 181 this->getWeaponManager()->setSlotPosition(3, Vector(-1.63, .678, -.652)); 182 this->getWeaponManager()->setSlotDirection(3, Quaternion(-24/180 * M_PI, Vector(1,0,0))); 183 184 this->getWeaponManager()->setSlotPosition(4, Vector(-1.63, .678, .652)); 185 this->getWeaponManager()->setSlotDirection(4, Quaternion(24/180 * M_PI, Vector(1,0,0))); 205 186 206 187 this->getWeaponManager()->getFixedTarget()->setParent(&(this->cameraNode)); 207 this->getWeaponManager()->getFixedTarget()->setRelCoor(0,0,0);208 209 dynamic_cast<Element2D*>(this->getWeaponManager()->getFixedTarget())->setVisibility( false);210 211 188 } 212 189 … … 222 199 void Hover::attachCamera() 223 200 { 224 State::getCamera()->setParentSoft( this->getWeaponManager()->getFixedTarget());201 State::getCamera()->setParentSoft(&this->cameraNode); 225 202 State::getCameraTarget()->setParentSoft(this->getWeaponManager()->getFixedTarget()); 226 203 … … 285 262 } 286 263 287 // rotorrotation288 // this->topRotor.shiftDir(Quaternion(time*10, Vector(0,1,0)));289 // this->tailRotor.shiftDir(Quaternion(time*10, Vector(0,1,0)));290 291 264 // spaceship controlled movement 292 265 this->calculateVelocity(time); … … 296 269 // this is the air friction (necessary for a smooth control) 297 270 if(velocity.len() != 0) velocity -= velocity*0.1; 298 299 //travelSpeed = velocity.len();300 301 //physics: Gravity302 /*this->shiftCoor(Vector(0,-1,0));303 304 this->shiftCoor(getAbsDirY()*rotorspeed);305 */306 307 /*308 //hoover effect309 cycle += time;310 this->shiftCoor(Vector(0,1,0)*cos(this->cycle*2.0)*0.02);311 */312 313 //readjust314 // if (this->getAbsDirZ().y > 0.1) this->shiftDir(Quaternion(time*0.3, Vector(1,0,0)));315 //else if (this->getAbsDirZ().y < -0.1) this->shiftDir(Quaternion(-time*0.3, Vector(1,0,0)));316 317 //SDL_WarpMouse(GraphicsEngine::getInstance()->getResolutionX()/2, GraphicsEngine::getInstance()->getResolutionY()/2);318 319 271 this->shiftCoor (move); 320 //this->shiftDir(Quaternion(-M_PI/4*tailrotorspeed, Vector(0,1,0)));321 272 322 273 this->getWeaponManager()->tick(time); -
trunk/src/world_entities/space_ships/hover.h
r6800 r6803 14 14 public: 15 15 16 Hover();17 16 Hover(const char* fileName); 18 Hover(const TiXmlElement* root );17 Hover(const TiXmlElement* root = NULL); 19 18 virtual ~Hover(); 20 19 21 void init();22 20 virtual void loadParams(const TiXmlElement* root); 23 21 … … 34 32 35 33 virtual void process(const Event &event); 34 35 private: 36 void init(); 36 37 37 38 private: -
trunk/src/world_entities/space_ships/space_ship.cc
r6764 r6803 132 132 133 133 this->getWeaponManager()->changeWeaponConfig(1); 134 135 EventHandler::getInstance()->grabEvents(true);136 134 137 135 bUp = bDown = bLeft = bRight = bAscend = bDescend = bRollL = bRollR = false; … … 143 141 controlVelocityX = 25; 144 142 controlVelocityY = 150; 145 shipInertia = 1.5 143 shipInertia = 1.5; 146 144 // cycle = 0.0; 147 145
Note: See TracChangeset
for help on using the changeset viewer.