Changeset 10043 in orxonox.OLD for branches/playability/src
- Timestamp:
- Dec 12, 2006, 6:27:39 PM (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
r10037 r10043 375 375 this->travelDistancePlus = Vector2D(38.0, 43.0); 376 376 this->travelDistanceMinus = Vector2D(-38.0, -43.0); 377 this->travelSpeed = 80;378 377 this->cameraSpeed = 40; 379 378 this->cameraLook = 0.0f; 380 this->acceleration = 120.0f;381 379 //this->airFriction = 0.0f; 382 380 … … 404 402 { 405 403 //this->direction = Quaternion (rot.getHeading(), Vector(0,1,0)); 406 }407 408 void SpaceShip::setTravelSpeed(float travelSpeed)409 {410 this->travelSpeed = travelSpeed;411 404 } 412 405 … … 533 526 this->engineSpeedCur = this->engineSpeedBase + this->reactorOutput * this->engineEnergyShare; 534 527 528 // calculation of maxSpeed and acceleration: 529 this->travelSpeed = this->engineSpeedCur * 5; 530 this->acceleration = this->travelSpeed * 2; 535 531 536 532 /* … … 569 565 this->cameraNode.setRelDirSoft(this->getAbsDir(), 30.0f); 570 566 571 this->burstEmitter->setEmissionRate(t ravelSpeed);572 this->burstEmitter->setEmissionVelocity(t ravelSpeed*.5, travelSpeed *.1);567 this->burstEmitter->setEmissionRate(this->cameraSpeed + (velocity.z>0)*velocity.z); 568 this->burstEmitter->setEmissionVelocity(this->cameraSpeed + (velocity.z>0)*velocity.z, travelSpeed *.1); 573 569 574 570 //orient the spaceship in direction of the mouse … … 833 829 //the ship doesn't slide too much. 834 830 float airCoeff = 2.5; 835 836 831 float pi = 3.14; 837 838 832 839 833 … … 883 877 if( this->systemFailure() ) 884 878 bForward = bBackward = bLeft = bRight = false; 885 886 879 887 880 if( this->bForward ) … … 940 933 this->velocity.z = 0.0f; 941 934 } 942 this->setRelDirSoft(Quaternion(-pi/6, Vector(1,0,0)), 3);935 this->setRelDirSoft(Quaternion(-pi/6, Vector(1,0,0)), 6); 943 936 } 944 937 … … 960 953 this->velocity.z = 0.0f; 961 954 } 962 this->setRelDirSoft(Quaternion(pi/6, Vector(1,0,0)), 3);955 this->setRelDirSoft(Quaternion(pi/6, Vector(1,0,0)), 6); 963 956 } 964 957 if (!this->bRight && !this->bLeft) 965 958 { 966 this->setRelDirSoft(Quaternion(0, Vector(1,0,0)), 3); 967 } 959 this->setRelDirSoft(Quaternion(0, Vector(1,0,0)), 6); 960 } 961 968 962 969 963 this->travelNode->shiftCoor(Vector(this->cameraSpeed * dt, 0, 0)); 970 964 this->shiftCoor (this->velocity * dt); 971 965 972 973 break; 966 //normalisation of the vectors (vector sum must be <= travelspeed) 967 float xzNorm = sqrt(pow(this->velocity.x, 2) + pow(this->velocity.z, 2)); 968 if (xzNorm > this->travelSpeed) 969 { 970 this->velocity.x = this->velocity.x/xzNorm * this->travelSpeed; 971 this->velocity.z = this->velocity.z/xzNorm * this->travelSpeed; 972 } 973 974 //this moves camera and ship along the travel path. 975 this->travelNode->shiftCoor(Vector(this->cameraSpeed * dt, 0, 0)); 976 977 //set new coordinates calculated through key- events. 978 this->shiftCoor (this->velocity * dt); 979 break; 974 980 } 975 981 case Playable::Vertical: 976 {977 982 break; 978 }979 983 default: 980 984 PRINTF(4)("Playmode %s Not Implemented in %s\n", Playable::playmodeToString(this->getPlaymode()).c_str(), this->getClassCName()); -
branches/playability/src/world_entities/space_ships/space_ship.h
r10032 r10043 30 30 31 31 virtual void setPlayDirection(const Quaternion& rot, float speed = 0.0f); 32 void setTravelSpeed(float travelSpeed);33 32 /* 34 33 void setTravelHeight(float travelHeight); … … 145 144 */ 146 145 147 Vector velocity; //!< the velocity of the player.146 Vector velocity; //!< the velocity of the player. 148 147 149 148 // 2D-traveling
Note: See TracChangeset
for help on using the changeset viewer.