Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/FICN/src/orxonox/objects/Projectile.cc @ 644

Last change on this file since 644 was 644, checked in by landauf, 17 years ago

added free-view-mode (hold right mouse button pressed)

File size: 1.1 KB
Line 
1#include "Projectile.h"
2#include "../core/CoreIncludes.h"
3
4namespace orxonox
5{
6    CreateFactory(Projectile);
7
8    Projectile::Projectile(SpaceShip* owner)
9    {
10        RegisterObject(Projectile);
11
12        this->owner_ = owner;
13
14        SetConfigValue(lifetime_, 10.0);
15        SetConfigValue(speed_, 2000.0);
16
17        this->billboard_.setBillboardSet("Examples/Flare", ColourValue(1.0, 1.0, 0.5), 1);
18        this->attachObject(this->billboard_.getBillboardSet());
19        this->scale(0.5);
20
21        if (this->owner_)
22        {
23            this->setStatic(false);
24            this->setOrientation(this->owner_->getOrientation());
25            this->setPosition(this->owner_->getPosition());
26            this->translate(Vector3(55, 0, 0), Ogre::Node::TS_LOCAL);
27            this->setVelocity(Vector3(1, 0, 0) * this->speed_);
28        }
29
30        this->destroyTimer_.setTimer(this->lifetime_, false, this, &Projectile::destroyObject);
31    }
32
33    Projectile::~Projectile()
34    {
35    }
36
37    void Projectile::destroyObject()
38    {
39        delete this;
40    }
41}
Note: See TracBrowser for help on using the repository browser.