- Timestamp:
- Dec 3, 2005, 10:30:42 PM (19 years ago)
- Location:
- branches/spaceshipcontrol/src/world_entities/space_ships
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/spaceshipcontrol/src/world_entities/space_ships/space_ship.cc
r5906 r5907 115 115 travelSpeed = 15.0; 116 116 this->velocity = Vector(0.0,0.0,0.0); 117 this->velocityDir = Vector(1.0,0.0,0.0); 117 118 118 119 // GLGuiButton* button = new GLGuiPushButton(); … … 280 281 /* FIXME: calculating the direction and orthDirection every timeSlice is redundant! save it somewhere */ 281 282 /* calculate the direction in which the craft is heading */ 282 Vector forwardDirection (1.0, 0.0, 0.0); 283 Vector forwardDirection (1.0, 0.0, 0.0); //x 283 284 //direction = this->absDirection.apply (direction); 284 Vector rightDirection (0.0, 0.0, 1.0);285 Vector rightDirection (0.0, 0.0, 0.1); //y 285 286 //orthDirection = orthDirection.cross (direction); 286 Vector upDirection (0.0, 1.0, 0.0); 287 Vector upDirection (0.0, 1.0, 0.0); //z 288 289 287 290 288 291 289 292 if( this->bUp ) 290 293 { 291 //if(velocity.len() == 0) 292 accel += forwardDirection; 293 //else 294 //travelSpeed++; 294 if(travelSpeed <= 5000) travelSpeed += 10; 295 295 } 296 296 297 297 if( this->bDown ) 298 { 299 //if(velocity.len() == 0) 300 accel -= forwardDirection; 301 // else 302 //travelSpeed--; 298 { 299 if(travelSpeed >= 10) travelSpeed -= 10; 303 300 } 304 301 305 302 if( this->bLeft /* > -this->getRelCoor().z*2*/) 306 303 { 307 accel -= rightDirection; 304 velocityDir -= rightDirection; 305 velocityDir.normalize(); 308 306 //rot +=Vector(1,0,0); 309 307 //rotVal -= .4; … … 311 309 if( this->bRight /* > this->getRelCoor().z*2*/) 312 310 { 313 accel += rightDirection; 311 velocityDir += rightDirection; 312 velocityDir.normalize(); 314 313 //rot += Vector(1,0,0); 315 314 //rotVal += .4; … … 328 327 } 329 328 330 velocity += accel*time;329 velocity = velocityDir*(time*travelSpeed); 331 330 //rot.normalize(); 332 331 //this->setRelDirSoft(Quaternion(rotVal, rot), 5); -
branches/spaceshipcontrol/src/world_entities/space_ships/space_ship.h
r5893 r5907 57 57 58 58 Vector velocity; //!< the velocity of the player. 59 Vector velocityDir; //!< the direction of the velocity of the spaceship 59 60 float travelSpeed; //!< the current speed of the player (to make soft movement) 60 61 float acceleration; //!< the acceleration of the player.
Note: See TracChangeset
for help on using the changeset viewer.