Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Mar 9, 2009, 12:58:08 AM (16 years ago)
Author:
scheusso
Message:

removed the lines that the student have to find out themselves

Location:
code/branches/tutorial/src/orxonox/objects/worldentities
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/branches/tutorial/src/orxonox/objects/worldentities/Drone.cc

    r2765 r2766  
    2121 *
    2222 *   Author:
    23  *      Fabian 'x3n' Landau
     23 *      Oli Scheuss
    2424 *   Co-authors:
    2525 *      ...
     
    3535namespace orxonox
    3636{
    37     // put your code in here:
     37    // PLACE YOUR CODE HERE
    3838    // create the factory for the drone
    3939    CreateFactory(Drone);
     
    4141    Drone::Drone(BaseObject* creator) : ControllableEntity(creator)
    4242    {
    43         //put your code in here:
     43        this->myController_ = 0;
     44        // PLACE YOUR CODE HERE
    4445        // - register the drone class to the core
    4546        // - create a new controller and pass our this pointer to it as creator
    46         this->myController_ = 0;
    47         RegisterObject(Drone);
    4847       
    4948        this->localLinearAcceleration_.setValue(0, 0, 0);
     
    7069        SUPER(Drone, XMLPort, xmlelement, mode);
    7170
    72         XMLPortParamVariable(Drone, "primaryThrust",  primaryThrust_,  xmlelement, mode);
    73         XMLPortParamVariable(Drone, "auxilaryThrust", auxilaryThrust_, xmlelement, mode);
    74         XMLPortParamVariable(Drone, "rotationThrust", rotationThrust_, xmlelement, mode);
     71        // PLACE YOUR CODE HERE
     72        // make sure you add the variables primaryThrust_, auxilaryThrust_ and rotationThrust_ to xmlport
     73        // variables can be added by the following command
     74        // XMLPortParamVariable(Class, "xml-attribute-name",  variable_name,  xmlelement, mode);
    7575    }
    7676
    7777    void Drone::tick(float dt)
    7878    {
    79         SUPER(Drone, tick, dt);
     79        // PLACE YOUR CODE HERE
     80        // make sure the tick function of the base class gets called here
    8081       
    81         //if (this->hasLocalController())
    82         //{
    83             this->localLinearAcceleration_.setX(this->localLinearAcceleration_.x() * getMass() * this->auxilaryThrust_);
    84             this->localLinearAcceleration_.setY(this->localLinearAcceleration_.y() * getMass() * this->auxilaryThrust_);
    85             if (this->localLinearAcceleration_.z() > 0)
    86               this->localLinearAcceleration_.setZ(this->localLinearAcceleration_.z() * getMass() * this->auxilaryThrust_);
    87             else
    88               this->localLinearAcceleration_.setZ(this->localLinearAcceleration_.z() * getMass() * this->primaryThrust_);
    89             this->physicalBody_->applyCentralForce(physicalBody_->getWorldTransform().getBasis() * this->localLinearAcceleration_);
    90             this->localLinearAcceleration_.setValue(0, 0, 0);
    91        
    92             this->localAngularAcceleration_ *= this->getLocalInertia() * this->rotationThrust_;
    93             this->physicalBody_->applyTorque(physicalBody_->getWorldTransform().getBasis() * this->localAngularAcceleration_);
    94             this->localAngularAcceleration_.setValue(0, 0, 0);
    95         //}
     82        this->localLinearAcceleration_.setX(this->localLinearAcceleration_.x() * getMass() * this->auxilaryThrust_);
     83        this->localLinearAcceleration_.setY(this->localLinearAcceleration_.y() * getMass() * this->auxilaryThrust_);
     84        if (this->localLinearAcceleration_.z() > 0)
     85          this->localLinearAcceleration_.setZ(this->localLinearAcceleration_.z() * getMass() * this->auxilaryThrust_);
     86        else
     87          this->localLinearAcceleration_.setZ(this->localLinearAcceleration_.z() * getMass() * this->primaryThrust_);
     88        this->physicalBody_->applyCentralForce(physicalBody_->getWorldTransform().getBasis() * this->localLinearAcceleration_);
     89        this->localLinearAcceleration_.setValue(0, 0, 0);
     90   
     91        this->localAngularAcceleration_ *= this->getLocalInertia() * this->rotationThrust_;
     92        this->physicalBody_->applyTorque(physicalBody_->getWorldTransform().getBasis() * this->localAngularAcceleration_);
     93        this->localAngularAcceleration_.setValue(0, 0, 0);
    9694    }
    9795   
  • code/branches/tutorial/src/orxonox/objects/worldentities/Drone.h

    r2765 r2766  
    2121 *
    2222 *   Author:
    23  *      Fabian 'x3n' Landau
     23 *      Oli Scheuss
    2424 *   Co-authors:
    2525 *      ...
Note: See TracChangeset for help on using the changeset viewer.