Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 8430


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

added lift_ and stallSpeed_ for better flight behavior

Location:
code/branches/steering
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • code/branches/steering/data/levels/templates/spaceshipAssff.oxt

    r7845 r8430  
    1414   primaryThrust     = 100;
    1515   auxilaryThrust    = 30;
    16    rotationThrust    = 25;
     16   rotationThrust    = 60;
     17
     18   lift = 0.2;
     19   stallSpeed = 220;
    1720
    1821   collisionType     = "dynamic"
  • code/branches/steering/src/orxonox/worldentities/MobileEntity.cc

    r7163 r8430  
    8383                this->linearVelocity_.z += this->linearAcceleration_.z * dt;
    8484                this->node_->translate(this->linearVelocity_ * dt);
     85
     86   
    8587
    8688                // Angular part
  • 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
  • code/branches/steering/src/orxonox/worldentities/pawns/SpaceShip.h

    r8223 r8430  
    8989            float boostPowerRate_;
    9090            float boostCooldownDuration_;
     91            float lift_;
     92            float stallSpeed_;
    9193            Vector3 steering_;
    9294            float primaryThrust_;
     
    9698            btVector3 localAngularAcceleration_;
    9799
     100         
     101
    98102        private:
    99103            void registerVariables();
     
    101105
    102106            void loadEngineTemplate();
    103            
     107
    104108            void boostCooledDown(void);
    105109
Note: See TracChangeset for help on using the changeset viewer.