Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
May 26, 2011, 2:29:03 PM (14 years ago)
Author:
dafrick
Message:

Merging steering branch into presentation branch.

Location:
code/branches/presentation
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • code/branches/presentation

  • code/branches/presentation/src/orxonox/worldentities/pawns/SpaceShip.cc

    r8589 r8597  
    3636#include "core/XMLPort.h"
    3737#include "tools/Shader.h"
     38#include "util/Debug.h" // TODO: Needed?
    3839#include "util/Math.h"
    3940
     
    6869        this->boostCooldownDuration_ = 5.0;
    6970        this->bBoostCooldown_ = false;
     71
     72        this->lift_ = 1.0f;                         // factor of the lift, standard is 1
     73        this->stallSpeed_ = 220.0f;                 // max speed where lift is added
    7074
    7175        this->bInvertYAxis_ = false;
     
    116120                XMLPortParamVariable(SpaceShip, "shakeFrequency", shakeFrequency_, xmlelement, mode);
    117121        XMLPortParamVariable(SpaceShip, "shakeAmplitude", shakeAmplitude_, xmlelement, mode);
     122                XMLPortParamVariable(SpaceShip, "lift", lift_, xmlelement, mode);
     123        XMLPortParamVariable(SpaceShip, "stallSpeed", stallSpeed_, xmlelement, mode);
    118124
    119125        XMLPortObject(SpaceShip, Engine, "engines", addEngine, getEngine, xmlelement, mode);
     
    132138        registerVariable(this->shakeFrequency_, VariableDirection::ToClient);
    133139        registerVariable(this->shakeAmplitude_, VariableDirection::ToClient);
     140        registerVariable(this->lift_, VariableDirection::ToClient);
     141        registerVariable(this->stallSpeed_, VariableDirection::ToClient);
    134142    }
    135143
     
    240248    void SpaceShip::rotatePitch(const Vector2& value)
    241249    {
    242         this->localAngularAcceleration_.setX(this->localAngularAcceleration_.x() + value.x);
     250        this->localAngularAcceleration_.setX(this->localAngularAcceleration_.x() + value.x*0.8);
    243251
    244252        Pawn::rotatePitch(value);
     253
     254                //This function call adds a lift to the ship when it is pitching to make it's movement more "realistic" and enhance the feeling.
     255        if (abs(this-> getLocalVelocity().z) < stallSpeed_)  {this->moveUpDown(lift_ / 5 * value * sqrt(abs(this-> getLocalVelocity().z)));}
    245256    }
    246257
  • code/branches/presentation/src/orxonox/worldentities/pawns/SpaceShip.h

    r8594 r8597  
    9898            float boostPowerRate_;
    9999            float boostCooldownDuration_;
     100            float lift_;
     101            float stallSpeed_;
    100102            Vector3 steering_;
    101103            float primaryThrust_;
Note: See TracChangeset for help on using the changeset viewer.