Changeset 10291 in orxonox.OLD for branches/playability/src/world_entities/space_ships
- Timestamp:
- Jan 18, 2007, 12:08:19 AM (18 years ago)
- Location:
- branches/playability/src/world_entities/space_ships
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/playability/src/world_entities/space_ships/space_ship.cc
r10289 r10291 65 65 66 66 #include "track/track.h" 67 #include "math.h" 67 68 68 69 … … 349 350 350 351 //this->airFriction = 0.5f; 351 this->travelDistancePlus = Vector2D(38.0, 43.0); 352 this->travelDistanceMinus = Vector2D(-38.0, -43.0); 352 //this->travelDistancePlus = Vector2D(38.0, 43.0); 353 //this->travelDistanceMinus = Vector2D(-38.0, -43.0); 354 this->travelDistancePlus = Vector2D(0,0); 355 this->travelDistancePlus = Vector2D(0,0); 356 this->isTravelDistanceInit = false; 357 this->actionWidthPercentage = 0.7; 358 353 359 this->cameraSpeed = 40; 354 360 this->cameraLook = 0.0f; … … 397 403 LoadParam(root, "cameraDistance", this, SpaceShip, setCameraDistance); 398 404 LoadParam(root, "cameraFovy", this, SpaceShip, setCameraFovy); 405 LoadParam(root, "actionWidthPercentage", this, SpaceShip, setActionWidthPercentage); 399 406 400 407 State::getCamera()->setViewMode(Camera::ViewTop); … … 553 560 this->trailR->tick(time); 554 561 562 if (!this->isTravelDistanceInit) 563 { 564 this->updateTravelDistance(); 565 this->isTravelDistanceInit = true; 566 } 567 555 568 //orient the spaceship in direction of the mouse 556 569 /* … … 578 591 this->bLeft = event.bPressed; 579 592 else if( event.type == KeyMapper::PEV_RIGHT) 593 { 580 594 this->bRight = event.bPressed; 595 printf("ShipCoorX: %f \n", this->getRelCoor().x); 596 } 581 597 else if( event.type == KeyMapper::PEV_FORWARD) 598 { 582 599 this->bForward = event.bPressed; //this->shiftCoor(0,.1,0); 600 601 } 583 602 else if( event.type == KeyMapper::PEV_BACKWARD) 584 603 this->bBackward = event.bPressed; //this->shiftCoor(0,-.1,0); … … 823 842 this->travelNode->setAbsCoor(this->getAbsCoor()); 824 843 this->travelNode->updateNode(0.01f); 844 this->isTravelDistanceInit = false; 825 845 826 846 this->setParent(this->travelNode); … … 844 864 State::getCamera()->setParentMode(PNODE_MOVEMENT); 845 865 866 //this->updateTravelDistance(); 867 846 868 this->debugNode(1); 847 869 this->travelNode->debugNode(1); … … 865 887 float airCoeff = 2.5; 866 888 float pi = 3.14; 867 868 889 869 890 switch(this->getPlaymode()) … … 915 936 if( this->bForward ) 916 937 { 938 //printf("ShipCoorX: %f \n", this->getRelCoor().x); 917 939 if(this->getRelCoor().x < this->travelDistancePlus.x) 918 940 { … … 973 995 if( this->bRight) 974 996 { 997 //printf("ShipCoorZ: %f \n", this->getRelCoor().z); 975 998 if(this->getRelCoor().z < this->travelDistancePlus.y) 976 999 { … … 1096 1119 State::getCamera()->setViewTopFovy(fovy); 1097 1120 } 1121 1122 void SpaceShip::updateTravelDistance() 1123 { 1124 float x = fabsf(State::getCamera()->getAbsCoor().y) * tan(State::getCamera()->getFovy()*M_PI /360.0); 1125 float y = x / State::getCamera()->getAspectRatio(); 1126 //State::getCamera()->setAbsCoor(-5, 1000, 0); 1127 1128 1129 //State::getCamera()->getAbsCoor().print(); 1130 printf("CameraRelCoorY: %f \n", State::getCamera()->getRelCoor().y); 1131 1132 printf("x: %f, y: %f \n", x, y); 1133 this->travelDistancePlus = Vector2D(x, y); 1134 this->travelDistanceMinus = Vector2D(-x, -y); 1135 1136 //this->isTravelDistanceInit = true; 1137 } -
branches/playability/src/world_entities/space_ships/space_ship.h
r10274 r10291 78 78 virtual void damage(float pDamage, float eDamage); //!< pDamage physical damage, eDamage electronic damage 79 79 80 //included by Michel: ((80 //included by Michel: 81 81 virtual void enterPlaymode(Playable::Playmode playmode); 82 82 void setPlaymodeXML(const std::string& playmode); //recieves the playmode from a string (useful for script implementation) 83 inline void setActionWidthPercentage(float f) {this->actionWidthPercentage = f; updateTravelDistance();}; 84 void updateTravelDistance(); 83 85 virtual void movement (float dt); 84 86 85 // ))87 // 86 88 87 89 void nextWeaponConfig(); … … 175 177 Vector2D travelDistancePlus; //!< Travel-Distance away from the TravelNode 176 178 Vector2D travelDistanceMinus; 179 bool isTravelDistanceInit; 180 181 float actionWidthPercentage; 177 182 178 183 // Camera
Note: See TracChangeset
for help on using the changeset viewer.