Changeset 6058 in orxonox.OLD for branches/spaceshipcontrol
- Timestamp:
- Dec 12, 2005, 1:04:24 PM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/spaceshipcontrol/src/world_entities/space_ships/helicopter.cc
r6052 r6058 245 245 Vector move = (velocity)*time; 246 246 247 //orient the velocity in the direction of the spaceship.248 //travelSpeed = velocity.len();249 //velocity += ((this->getAbsDirX())*travelSpeed-velocity)*airViscosity;250 //velocity = (velocity.getNormalized())*travelSpeed;251 252 247 // this is the air friction (necessary for a smooth control) 253 if(velocity.len() != 0) velocity -= velocity*0. 01;248 if(velocity.len() != 0) velocity -= velocity*0.1; 254 249 255 if(this->getAbsDirX().y < -0.2) this->shiftDir(Quaternion(time, Vector(0,0,1)));256 else if(this->getAbsDirX().y > 0.2) this->shiftDir(Quaternion(-time, Vector(0,0,1)));257 250 258 251 //hoover effect … … 289 282 //this->shiftCoor(this->getAbsDirX()); 290 283 accel += Vector(this->getAbsDirX().x,0,this->getAbsDirX().z).getNormalized()*2; 291 rot += Vector (0,0,1); 292 rotVal -= .004; 284 if((this->getAbsDirX()).y > -.2) 285 { 286 rot += Vector (0,0,1); 287 rotVal -= .4; 288 } 289 } 290 else 291 { 292 if(this->getAbsDirX().y < -.02) this->shiftDir(Quaternion(time/5, Vector(0,0,1))); 293 293 } 294 294 … … 297 297 //this->shiftCoor((this->getAbsDirX())*-1); 298 298 accel -= Vector(this->getAbsDirX().x,0,this->getAbsDirX().z).getNormalized()*2; 299 rot += Vector (0,0,1); 300 rotVal += .004; 299 if((this->getAbsDirX()).y < .2) 300 { 301 rot += Vector (0,0,1); 302 rotVal += .4; 303 } 301 304 } 305 else 306 { 307 if(this->getAbsDirX().y > 0.02) this->shiftDir(Quaternion(-time/5, Vector(0,0,1))); 308 } 302 309 303 310 if( this->bLeft /* > -this->getRelCoor().z*2*/) 304 311 { 305 312 //this->shiftDir(Quaternion(time, Vector(0,1,0))); 306 accel -= (this->getAbsDirZ()); 307 //velocityDir.normalize(); 308 rot +=Vector(1,0,0); 309 rotVal -= .002; 313 accel -= Vector(this->getAbsDirZ().x,0,this->getAbsDirZ().z).getNormalized()*2; 314 //velocityDir.normalize(); 315 if((this->getAbsDirZ()).y < .2) 316 { 317 rot +=Vector(1,0,0); 318 rotVal -= .06; 319 } 310 320 } 311 321 if( this->bRight /* > this->getRelCoor().z*2*/) … … 313 323 //this->shiftDir(Quaternion(-time, Vector(0,1,0))); 314 324 315 accel += (this->getAbsDirZ()); 316 //velocityDir.normalize(); 317 rot += Vector(1,0,0); 318 rotVal += .002; 325 accel += Vector(this->getAbsDirZ().x,0,this->getAbsDirZ().z).getNormalized()*2; 326 //velocityDir.normalize(); 327 if((this->getAbsDirZ()).y > -.2) 328 { 329 rot += Vector(1,0,0); 330 rotVal += .06; 331 } 319 332 } 320 333 … … 409 422 this->xMouse = event.xRel; 410 423 this->yMouse = event.yRel; 411 //this->shiftDir(Quaternion(-M_PI/4*xMouse*mouseSensitivity, Vector(0,1,0))*Quaternion(-M_PI/4*yMouse*mouseSensitivity, Vector(0,0,1))); 424 if(((this->getAbsDirX().y) <= .2 && yMouse > 0) || ((this->getAbsDirX().y) >= -.2 && yMouse < 0)) yMouse = 0; 425 this->shiftDir(Quaternion(-M_PI/4*xMouse*mouseSensitivity, Vector(0,1,0))*Quaternion(-M_PI/4*yMouse*mouseSensitivity, Vector(0,0,1))); 412 426 } 413 427 }
Note: See TracChangeset
for help on using the changeset viewer.