Changeset 5897 in orxonox.OLD for branches/spaceshipcontrol
- Timestamp:
- Dec 3, 2005, 5:34:09 PM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/spaceshipcontrol/src/world_entities/space_ships/space_ship.cc
r5894 r5897 108 108 109 109 PRINTF(4)("SPACESHIP INIT\n"); 110 travelSpeed = 100.0; 110 111 111 112 bUp = bDown = bLeft = bRight = bAscend = bDescend = false; 112 113 bFire = false; 113 acceleration = 50.0; 114 115 travelSpeed = 15.0; 116 this->velocity = Vector(0.0,0.0,0.0); 114 117 115 118 // GLGuiButton* button = new GLGuiPushButton(); … … 253 256 Vector move = (velocity)*time; 254 257 258 if( velocity.len() != 0 ) 259 { 260 this->setAbsDir(Quaternion(velocity, Vector(0,1,0)) * Quaternion ( -M_PI_2, Vector(0,1,0))); 261 } 262 255 263 this->shiftCoor (move); 256 264 … … 267 275 { 268 276 Vector accel(0.0, 0.0, 0.0); 269 Vector rot(0.0, 0.0, 0.0);270 float rotVal = 0.0;277 //Vector rot(0.0, 0.0, 0.0); 278 //float rotVal = 0.0; 271 279 /* FIXME: calculating the direction and orthDirection every timeSlice is redundant! save it somewhere */ 272 280 /* calculate the direction in which the craft is heading */ 273 281 Vector direction (1.0, 0.0, 0.0); 274 282 //direction = this->absDirection.apply (direction); 275 Vector orthDirection (0.0, 0.0, 1.0);283 Vector orthDirection (0.0, 0.0, 1.0); 276 284 //orthDirection = orthDirection.cross (direction); 277 285 278 if( this->bUp) 279 accel += direction; 280 if( this->bDown) 281 accel -= direction; 286 287 if( this->bUp ) 288 travelSpeed++; 289 if( this->bDown ) 290 travelSpeed--; 291 282 292 283 293 if( this->bLeft /* > -this->getRelCoor().z*2*/) 284 294 { 285 295 accel -=(orthDirection); 286 rot +=Vector(1,0,0);287 rotVal -= .4;296 //rot +=Vector(1,0,0); 297 //rotVal -= .4; 288 298 } 289 299 if( this->bRight /* > this->getRelCoor().z*2*/) 290 300 { 291 301 accel += orthDirection; 292 rot += Vector(1,0,0);293 rotVal += .4;302 //rot += Vector(1,0,0); 303 //rotVal += .4; 294 304 } 295 305 if (this->bAscend ) 296 306 { 297 307 accel += Vector(0,1,0); 298 rot += Vector(0,0,1);299 rotVal += .4;308 //rot += Vector(0,0,1); 309 //rotVal += .4; 300 310 } 301 311 if (this->bDescend ) 302 312 { 303 313 accel -= Vector(0,1,0); 304 rot += Vector(0,0,1);305 rotVal -= .4;314 //rot += Vector(0,0,1); 315 //rotVal -= .4; 306 316 } 307 317 308 318 velocity += accel*time; 309 rot.normalize(); 310 this->setRelDirSoft(Quaternion(rotVal, rot), 5); 319 velocity = (velocity.getNormalized() ) *travelSpeed; 320 //rot.normalize(); 321 //this->setRelDirSoft(Quaternion(rotVal, rot), 5); 311 322 } 312 323
Note: See TracChangeset
for help on using the changeset viewer.