Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Feb 14, 2006, 8:04:01 PM (19 years ago)
Author:
snellen
Message:

new condition to prevent jumping

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/control/src/world_entities/space_ships/space_ship.cc

    r7141 r7146  
    339339{
    340340  Playable::tick(time);
    341  
    342   if( ( xMouse != 0 
     341
     342  if( ( xMouse != 0
    343343        || yMouse != 0 )
    344         && this->getOwner() == this->getHostID()  )
     344        && this->getOwner() == this->getHostID()  )
    345345   {
    346346    if (xMouse > controlVelocityX) xMouse = controlVelocityX;
     
    351351    pitchDir = (Quaternion(xMouse*mouseSensitivity*0.5, Vector(1,0,0)));
    352352
    353     if( fabsf(mouseDir.distance(this->getAbsDir())) < maxRudderAmplitude )//prevent 'jumping'
    354     {
    355      
    356      mouseDir *= (Quaternion(-M_PI/4*xMouse*mouseSensitivity, Vector(0,1,0))*Quaternion(-M_PI/4*yMouse*mouseSensitivity*yInvert, Vector(0,0,1))*pitchDir);
    357     }
     353    Quaternion correctionQuat = (Quaternion(-M_PI/4*xMouse*mouseSensitivity, Vector(0,1,0))*Quaternion(-M_PI/4*yMouse*mouseSensitivity*yInvert, Vector(0,0,1))*pitchDir);
     354    if( fabsf((mouseDir*correctionQuat).distance(this->getAbsDir())) < maxRudderAmplitude )//prevent 'jumping'
     355     {
     356       mouseDir *= correctionQuat;
     357     }
     358    else
     359     {
     360       mouseDir = quatSlerp(mouseDir,mouseDir*correctionQuat,fabsf(time));
     361     }
    358362    xMouse = yMouse = 0;
    359363   }
    360364
    361  
     365
    362366
    363367//   if( this != State::getPlayer()->getControllable())
Note: See TracChangeset for help on using the changeset viewer.