Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Mar 22, 2010, 10:45:09 PM (15 years ago)
Author:
ebeier
Message:

first working version of the SpeedPickup, needs some more work for "onUse" type. Spaceship trails need to be looked at, because they don't show when a SpeedPickup with SpeedAdd is used.

Location:
code/branches/ppspickups1/src/orxonox/items
Files:
2 edited

Legend:

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

    r6540 r6607  
    6464        this->boostBlur_ = 0;
    6565
     66        this->speedAdd_ = 0.0;
     67        this->speedMultiply_ = 1.0;
     68
    6669        this->setConfigValues();
    6770        this->registerVariables();
     
    119122        registerVariable(this->accelerationLeftRight_, VariableDirection::ToClient);
    120123        registerVariable(this->accelerationUpDown_,    VariableDirection::ToClient);
     124
     125        registerVariable(this->speedAdd_, VariableDirection::ToClient);
     126        registerVariable(this->speedMultiply_, VariableDirection::ToClient);
    121127    }
    122128
     
    192198        }
    193199
    194         this->ship_->setAcceleration(this->ship_->getOrientation() * acceleration);
     200        this->ship_->setAcceleration(this->ship_->getOrientation() * (acceleration*this->getSpeedMultiply()+Vector3(0,0,-this->getSpeedAdd())));
    195201
    196202        if (!this->ship_->getPermanentBoost())
     
    241247            return Vector3::ZERO;
    242248    }
     249
     250    PickupCarrier* Engine::getCarrierParent(void)
     251    {
     252        return this->ship_;
     253    }
     254
     255    const Vector3& Engine::getCarrierPosition(void)
     256    {
     257        return this->ship_->getWorldPosition();
     258    }
    243259}
  • code/branches/ppspickups1/src/orxonox/items/Engine.h

    r6417 r6607  
    3535#include "Item.h"
    3636
     37#include "interfaces/PickupCarrier.h"
     38
    3739namespace orxonox
    3840{
    39     class _OrxonoxExport Engine : public Item, public Tickable
     41    class _OrxonoxExport Engine : public Item, public Tickable, public PickupCarrier
    4042    {
    4143        public:
     
    104106                { return this->accelerationUpDown_; }
    105107
     108            inline float getSpeedAdd(void)
     109                { return this->speedAdd_; }
     110            inline float getSpeedMultiply(void)
     111                { return this->speedMultiply_; }
     112
    106113            virtual const Vector3& getDirection() const;
     114
     115            virtual const Vector3& getCarrierPosition(void);
     116
     117            /* not in protected ?? */
     118            inline void setSpeedAdd(float speedAdd)
     119                { this->speedAdd_=speedAdd; }
     120            inline void setSpeedMultiply(float speedMultiply)
     121                { this->speedMultiply_=speedMultiply; }
     122
     123        protected:
     124            virtual std::list<PickupCarrier*>* getCarrierChildren(void)
     125                { return new std::list<PickupCarrier*>(); }
     126            virtual PickupCarrier* getCarrierParent(void);
    107127
    108128        private:
     
    114134            float boostFactor_;
    115135            float speedFactor_;
     136
     137            float speedAdd_;
     138            float speedMultiply_;
    116139
    117140            float maxSpeedFront_;
Note: See TracChangeset for help on using the changeset viewer.