Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 8658


Ignore:
Timestamp:
May 29, 2011, 1:40:53 PM (13 years ago)
Author:
landauf
Message:

the "lift" which is applied to the spaceship when pitching is now also applied when yawing.
moving up/down or left/right is now again possible.

Location:
code/branches/presentation/src/orxonox
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/branches/presentation/src/orxonox/items/Engine.cc

    r8654 r8658  
    158158        SUPER(Engine, tick, dt);
    159159
    160         const Vector3& direction = this->getDirection();
     160        Vector3 direction = this->getDirection();
     161        float directionLength = direction.length();
     162        if (directionLength > 1.0f)
     163            direction /= directionLength; // normalize
     164       
    161165        Vector3 velocity = this->ship_->getLocalVelocity();
    162166        Vector3 acceleration = Vector3::ZERO;
  • code/branches/presentation/src/orxonox/worldentities/pawns/SpaceShip.cc

    r8651 r8658  
    224224    {
    225225        this->localLinearAcceleration_.setZ(this->localLinearAcceleration_.z() - value.x);
    226         this->steering_.z = -value.x;
     226        this->steering_.z -= value.x;
    227227    }
    228228
     
    230230    {
    231231        this->localLinearAcceleration_.setX(this->localLinearAcceleration_.x() + value.x);
    232         this->steering_.x = value.x;
     232        this->steering_.x += value.x;
    233233    }
    234234
     
    236236    {
    237237        this->localLinearAcceleration_.setY(this->localLinearAcceleration_.y() + value.x);
    238         this->steering_.y = value.x;
     238        this->steering_.y += value.x;
    239239    }
    240240
     
    244244
    245245        Pawn::rotateYaw(value);
     246
     247                //This function call adds a lift to the ship when it is rotating to make it's movement more "realistic" and enhance the feeling.
     248        if (abs(this-> getLocalVelocity().z) < stallSpeed_)  {this->moveRightLeft(-lift_ / 5 * value * sqrt(abs(this-> getLocalVelocity().z)));}
    246249    }
    247250
Note: See TracChangeset for help on using the changeset viewer.