Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
May 9, 2011, 3:52:35 PM (13 years ago)
Author:
mastalde
Message:

added lift_ and stallSpeed_ for better flight behavior

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/steering/src/orxonox/worldentities/pawns/SpaceShip.cc

    r8223 r8430  
    3636#include "core/XMLPort.h"
    3737#include "items/Engine.h"
     38#include "util/Debug.h"
     39
    3840
    3941namespace orxonox
     
    5254        this->localLinearAcceleration_.setValue(0, 0, 0);
    5355        this->localAngularAcceleration_.setValue(0, 0, 0);
    54         this->bBoost_ = false;
     56        this->bBoost_ = false;
    5557        this->steering_ = Vector3::ZERO;
    5658        this->engine_ = 0;
     
    6365        this->bBoostCooldown_ = false;
    6466
     67        this->lift_ = 0.2f;
     68        this->stallSpeed = 220.0f;
     69
    6570        this->bInvertYAxis_ = false;
    6671
     
    7580        this->setConfigValues();
    7681        this->registerVariables();
    77     }
     82
     83
     84
     85       
     86}
    7887
    7988    SpaceShip::~SpaceShip()
     
    95104        XMLPortParamVariable(SpaceShip, "boostRate", boostRate_, xmlelement, mode);
    96105        XMLPortParamVariable(SpaceShip, "boostCooldownDuration", boostCooldownDuration_, xmlelement, mode);
     106        XMLPortParamVariable(SpaceShip, "float", float_, xmlelement, mode);
     107        XMLPortParamVariable(SpaceShip, "stallSpeed", stallSpeed_, xmlelement, mode);
    97108    }
    98109
     
    163174                }
    164175            }
     176       
     177COUT(1) << "Vel:" << this-> getLocalVelocity().z * -1 << endl;
     178               
    165179        }
    166180    }
     
    175189        this->localLinearAcceleration_.setZ(this->localLinearAcceleration_.z() - value.x);
    176190        this->steering_.z = -value.x;
     191
    177192    }
    178193
     
    181196        this->localLinearAcceleration_.setX(this->localLinearAcceleration_.x() + value.x);
    182197        this->steering_.x = value.x;
     198 
    183199    }
    184200
     
    187203        this->localLinearAcceleration_.setY(this->localLinearAcceleration_.y() + value.x);
    188204        this->steering_.y = value.x;
     205
     206
     207
     208
     209
    189210    }
    190211
     
    194215
    195216        Pawn::rotateYaw(value);
     217
    196218    }
    197219
    198220    void SpaceShip::rotatePitch(const Vector2& value)
    199221    {
    200         this->localAngularAcceleration_.setX(this->localAngularAcceleration_.x() + value.x);
     222        this->localAngularAcceleration_.setX(this->localAngularAcceleration_.x() + value.x * 0.8);
    201223
    202224        Pawn::rotatePitch(value);
     225
     226       
     227       
     228        if (abs(this-> getLocalVelocity().z) < stallSpeed)  {this->moveUpDown(float_*value*sqrt(abs(this-> getLocalVelocity().z)));}
     229
     230       
     231
     232
    203233    }
    204234
     
    208238
    209239        Pawn::rotateRoll(value);
     240 
    210241    }
    211242
Note: See TracChangeset for help on using the changeset viewer.