Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 7326 in orxonox.OLD for trunk/src/world_entities


Ignore:
Timestamp:
Apr 17, 2006, 2:42:37 PM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: limiting the maximum rotation speed of the turbine_hover, as proposed by the network-guys

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/world_entities/space_ships/turbine_hover.cc

    r7221 r7326  
    331331
    332332  this->velocity += (accelerationDir - damping)* dt;
    333 
    334333  this->shiftCoor (this->velocity * dt);
    335   this->rotation = 0.0f;
     334
     335  // limit the maximum rotation speed.
     336  if (this->rotation != 0.0f)
     337  {
     338    float maxRot = 10.0 * dt;
     339    if (unlikely(this->rotation > maxRot)) this->rotation = maxRot;
     340    if (unlikely(this->rotation < -maxRot)) this->rotation = -maxRot;
     341    this->direction *= Quaternion(-M_PI/4.0*this->rotation, Vector(0,1,0));
     342
     343    this->rotation = 0.0f;
     344  }
    336345
    337346  this->setRelDirSoft(this->direction * Quaternion(-cameraLook, Vector(0,0,1)), 5);
     
    421430
    422431    // rotate the Player around the y-axis
    423     this->direction *= Quaternion(-M_PI/4.0*xMouse, Vector(0,1,0));
    424432    this->rotation += xMouse;
    425433
Note: See TracChangeset for help on using the changeset viewer.