- Timestamp:
- Jan 31, 2006, 2:04:29 AM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/world_entities/space_ships/hover.cc
r6871 r6879 39 39 */ 40 40 Hover::~Hover () 41 { 42 43 } 41 {} 44 42 45 43 /** … … 112 110 this->cameraLook = 0.0f; 113 111 this->rotation = 0.0f; 112 this->acceleration = 1.0; 114 113 115 114 // camera - issue … … 241 240 this->movement(dt); 242 241 this->rotorCycle += this->rotorSpeed * dt; 243 244 Vector move = (velocity)*dt;245 246 // this is the air friction (necessary for a smooth control)247 if(velocity.len() != 0)248 velocity -= velocity*0.1;249 this->shiftCoor (move);250 251 this->rotation = 0.0f;252 242 } 253 243 … … 259 249 { 260 250 Vector accel(0.0, 0.0, 0.0); 261 float rot Val= .3;251 float rotSpeed = .3; 262 252 263 253 if( this->bForward ) 264 254 { 265 accel += Vector( rotVal, 0, 0);255 accel += Vector(this->acceleration, 0, 0); 266 256 } 267 257 268 258 if( this->bBackward ) 269 259 { 270 accel -= Vector( rotVal,0,0);260 accel -= Vector(this->acceleration, 0, 0); 271 261 } 272 262 if( this->bLeft) 273 263 { 274 accel -= Vector(0, 0,rotVal);264 accel -= Vector(0, 0, this->acceleration); 275 265 } 276 266 277 267 if( this->bRight) 278 268 { 279 accel += Vector(0, 0,rotVal);269 accel += Vector(0, 0, this->acceleration); 280 270 } 281 271 282 272 if (this->bAscend ) 283 273 { 284 accel += Vector(0, rotVal,0);274 accel += Vector(0, this->acceleration, 0); 285 275 } 286 276 if (this->bDescend ) 287 277 { 288 accel -= Vector(0,rotVal,0); 289 } 290 291 Vector tmp = this->getAbsDir().apply(accel * 30.0); 292 tmp.y = accel.y * 1000.0 * dt; 293 velocity += tmp; 294 295 278 accel -= Vector(0, this->acceleration, 0); 279 } 280 281 Vector tmp = this->getAbsDir().apply(accel * 500.0); 282 tmp.y = accel.y * 500.0 ; 283 velocity += tmp * dt; 284 285 accel -= velocity * .0005; 286 287 // this is the air friction (necessary for a smooth control) 288 this->velocity *= 0.95; 289 this->shiftCoor (velocity * dt); 290 this->rotation = 0.0f; 291 292 accel *=.5; 296 293 this->setRelDirSoft(this->direction * Quaternion(-accel.x, Vector(0,0,1)) * Quaternion(accel.z, Vector(1,0,0)), 5); 297 294 298 this->wingNodeLeft.setRelDirSoft(Quaternion(accel.z+this->rotation, Vector(1,0,0)), 10);299 this->rotorNodeLeft.setRelDirSoft(Quaternion(-2.0*accel.x+this->rotation, Vector(0,0,1)), 10);300 301 this->wingNodeRight.setRelDirSoft(Quaternion(accel.z+this->rotation, Vector(1,0,0)), 10);302 this->rotorNodeRight.setRelDirSoft(Quaternion(-2.0*accel.x-this->rotation, Vector(0,0,1)), 10);295 this->wingNodeLeft.setRelDirSoft(Quaternion(accel.z+this->rotation, Vector(1,0,0)), 5); 296 this->rotorNodeLeft.setRelDirSoft(Quaternion(-2.0*accel.x+this->rotation, Vector(0,0,1)), 5); 297 298 this->wingNodeRight.setRelDirSoft(Quaternion(accel.z+this->rotation, Vector(1,0,0)), 5); 299 this->rotorNodeRight.setRelDirSoft(Quaternion(-2.0*accel.x-this->rotation, Vector(0,0,1)), 5); 303 300 } 304 301 … … 391 388 else if (cameraLook < -M_PI_2) 392 389 cameraLook = -M_PI_2; 393 this->cameraNode.setRelDirSoft(Quaternion(-cameraLook, Vector(0,0,1)), 5);394 } 395 } 390 this->cameraNode.setRelDirSoft(Quaternion(-cameraLook, Vector(0,0,1)),10); 391 } 392 }
Note: See TracChangeset
for help on using the changeset viewer.