Changeset 10291 in orxonox.OLD for branches/playability/src/world_entities/space_ships/space_ship.cc
- Timestamp:
- Jan 18, 2007, 12:08:19 AM (18 years ago)
- File:
-
- 1 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 }
Note: See TracChangeset
for help on using the changeset viewer.