Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/hud/src/orxonox/objects/SpaceShip.cc @ 1613

Last change on this file since 1613 was 1613, checked in by rgrieder, 16 years ago
  • Radar now working like before
  • but more of a svn save..

There is class called Radar which takes care of the focus and all objects that can be displayed on a Radar.
The actual visual implementation is in HUDRadar.
To make a object radar viewable, simply implement RadarViewable and set the WorldEntitiy pointer in the constructor (assertation will fail otherwise!).
You can also set a camouflage value between 0 and 1 that tells how good a radar can see an object.
The HUDRadar (or another one) on the other side has a sensitivity between 0 and 1. So only if the sensitivity is higher than the camouflage value, the object gets displayed.

  • Property svn:eol-style set to native
File size: 21.0 KB
Line 
1/*
2 *   ORXONOX - the hottest 3D action shooter ever to exist
3 *                    > www.orxonox.net <
4 *
5 *
6 *   License notice:
7 *
8 *   This program is free software; you can redistribute it and/or
9 *   modify it under the terms of the GNU General Public License
10 *   as published by the Free Software Foundation; either version 2
11 *   of the License, or (at your option) any later version.
12 *
13 *   This program is distributed in the hope that it will be useful,
14 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
15 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 *   GNU General Public License for more details.
17 *
18 *   You should have received a copy of the GNU General Public License
19 *   along with this program; if not, write to the Free Software
20 *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
21 *
22 *   Author:
23 *      Fabian 'x3n' Landau
24 *   Co-authors:
25 *      Benjamin Knecht
26 *
27 */
28
29#include "OrxonoxStableHeaders.h"
30#include "SpaceShip.h"
31
32#include <OgreCamera.h>
33#include <OgreRenderWindow.h>
34#include <OgreParticleSystem.h>
35#include <OgreSceneNode.h>
36
37#include "CameraHandler.h"
38#include "util/Convert.h"
39#include "util/Math.h"
40#include "core/CoreIncludes.h"
41#include "core/ConfigValueIncludes.h"
42#include "core/Debug.h"
43#include "GraphicsEngine.h"
44//#include "core/input/InputManager.h"
45#include "tools/ParticleInterface.h"
46#include "RotatingProjectile.h"
47#include "ParticleProjectile.h"
48#include "core/XMLPort.h"
49#include "core/ConsoleCommand.h"
50#include "network/Client.h"
51
52namespace orxonox
53{
54    SetConsoleCommand(SpaceShip, setMaxSpeedTest, false).setAccessLevel(AccessLevel::Debug);
55    SetConsoleCommand(SpaceShip, whereAmI, true).setAccessLevel(AccessLevel::User);
56    SetConsoleCommand(SpaceShip, moveLongitudinal, true).setAccessLevel(AccessLevel::User).setDefaultValue(0, 1.0f).setAxisParamIndex(0).setKeybindMode(KeybindMode::OnHold);
57    SetConsoleCommand(SpaceShip, moveLateral, true).setAccessLevel(AccessLevel::User).setDefaultValue(0, 1.0f).setAxisParamIndex(0).setKeybindMode(KeybindMode::OnHold);
58    SetConsoleCommand(SpaceShip, moveYaw, true).setAccessLevel(AccessLevel::User).setDefaultValue(0, 1.0f).setAxisParamIndex(0).setKeybindMode(KeybindMode::OnHold);
59    SetConsoleCommand(SpaceShip, movePitch, true).setAccessLevel(AccessLevel::User).setDefaultValue(0, 1.0f).setAxisParamIndex(0).setKeybindMode(KeybindMode::OnHold);
60    SetConsoleCommand(SpaceShip, moveRoll, true).setAccessLevel(AccessLevel::User).setDefaultValue(0, 1.0f).setAxisParamIndex(0).setKeybindMode(KeybindMode::OnHold);
61    SetConsoleCommand(SpaceShip, fire, true).setAccessLevel(AccessLevel::User).setKeybindMode(KeybindMode::OnHold);
62    SetConsoleCommandGeneric(test1, SpaceShip, createConsoleCommand(createFunctor(&SpaceShip::setMaxSpeedTest), "setMaxSpeed"), false).setAccessLevel(AccessLevel::Debug);
63    SetConsoleCommandGeneric(test2, SpaceShip, createConsoleCommand(createFunctor(&SpaceShip::setMaxSpeedTest), "setMaxBlubber"), false).setAccessLevel(AccessLevel::Debug);
64    SetConsoleCommandGeneric(test3, SpaceShip, createConsoleCommand(createFunctor(&SpaceShip::setMaxSpeedTest), "setRofl"), false).setAccessLevel(AccessLevel::Debug);
65
66    CreateFactory(SpaceShip);
67
68    SpaceShip* SpaceShip::instance_s;
69
70
71    SpaceShip *SpaceShip::getLocalShip(){
72      Iterator<SpaceShip> it;
73      for(it = ObjectList<SpaceShip>::start(); it; ++it){
74        if( (it)->myShip_ )
75          return *it;
76      }
77      return NULL;
78    }
79
80    SpaceShip::SpaceShip()
81    {
82        RegisterObject(SpaceShip);
83
84        this->setRotationAxis(1, 0, 0);
85        this->setStatic(false);
86
87        this->zeroRadian_ = 0;
88        this->maxSideAndBackSpeed_ = 0;
89        this->maxSpeed_ = 0;
90        this->maxRotation_ = 0;
91        this->translationAcceleration_ = 0;
92        this->rotationAcceleration_ = 0;
93        this->translationDamping_ = 0;
94        this->rotationDamping_ = 0;
95        this->maxRotationRadian_ = 0;
96        this->rotationAccelerationRadian_ = 0;
97        this->rotationDampingRadian_ = 0;
98
99        this->cam_ = 0;
100        this->tt1_ = 0;
101        this->tt2_ = 0;
102
103        this->redNode_ = 0;
104        this->greenNode_ = 0;
105        this->blinkTime_ = 0;
106
107        this->timeToReload_ = 0;
108
109        this->setMouseEventCallback_ = false;
110        this->bLMousePressed_ = false;
111        this->bRMousePressed_ = false;
112        this->mouseXRotation_ = 0;
113        this->mouseYRotation_ = 0;
114        this->mouseX_ = 0;
115        this->mouseY_ = 0;
116        this->myShip_ = false;
117
118        this->registerAllVariables();
119
120        SpaceShip::instance_s = this;
121
122        this->setConfigValues();
123
124        this->initialDir_ = Vector3(1.0, 0.0, 0.0);
125        this->currentDir_ = initialDir_;
126        this->initialOrth_ = Vector3(0.0, 0.0, 1.0);
127        this->currentOrth_ = initialOrth_;
128
129        this->camName_ = this->getName() + "CamNode";
130
131        this->teamNr_ = 0;
132        this->health_ = 100;
133
134        this->radarObject_ = static_cast<WorldEntity*>(this);
135
136        COUT(3) << "Info: SpaceShip was loaded" << std::endl;
137    }
138
139    SpaceShip::~SpaceShip()
140    {
141        if (this->isInitialized())
142        {
143            if (this->tt1_)
144                delete this->tt1_;
145            if (this->tt2_)
146                delete this->tt2_;
147            if (this->cam_)
148                delete this->cam_;
149        }
150    }
151
152    bool SpaceShip::create(){
153      if(!myShip_){
154        if(network::Client::getSingleton() && objectID == network::Client::getSingleton()->getShipID())
155          myShip_=true;
156        else
157          this->setRadarObjectColour(this->getProjectileColour());
158      }
159      if(Model::create())
160        this->init();
161      else
162        return false;
163      return true;
164    }
165
166    void SpaceShip::registerAllVariables(){
167      registerVar( &camName_, camName_.length()+1, network::STRING, 0x1 );
168      registerVar( &maxSpeed_, sizeof(maxSpeed_), network::DATA, 0x1);
169      registerVar( &maxSideAndBackSpeed_, sizeof(maxSideAndBackSpeed_), network::DATA, 0x1);
170      registerVar( &maxRotation_, sizeof(maxRotation_), network::DATA, 0x1);
171      registerVar( &translationAcceleration_, sizeof(translationAcceleration_), network::DATA, 0x1);
172      registerVar( &rotationAcceleration_, sizeof(rotationAcceleration_), network::DATA, 0x1);
173      registerVar( &rotationAccelerationRadian_, sizeof(rotationAccelerationRadian_), network::DATA, 0x1);
174      registerVar( &translationDamping_, sizeof(translationDamping_), network::DATA, 0x1);
175      registerVar( &rotationDamping_, sizeof(rotationDamping_), network::DATA, 0x1);
176      registerVar( &rotationDampingRadian_, sizeof(rotationDampingRadian_), network::DATA, 0x1);
177
178    }
179
180    void SpaceShip::init()
181    {
182        // START CREATING THRUSTER
183        this->tt1_ = new ParticleInterface("Orxonox/thruster1", LODParticle::low);
184        this->tt1_->createNewEmitter();
185        this->tt1_->getAllEmitters()->setDirection(-this->getInitialDir());
186        this->tt1_->getEmitter(0)->setPosition(Vector3(-15, 20, -1));
187        this->tt1_->getEmitter(1)->setPosition(Vector3(-15, -20, -1));
188        this->tt1_->setSpeedFactor(3.0);
189
190        Ogre::SceneNode* node2a = this->getNode()->createChildSceneNode(this->getName() + "particle2a");
191        node2a->setInheritScale(false);
192        node2a->setScale(1, 1, 1);
193        tt1_->addToSceneNode(node2a);
194
195        this->tt2_ = new ParticleInterface("Orxonox/thruster2", LODParticle::normal);
196        this->tt2_->createNewEmitter();
197        this->tt2_->getAllEmitters()->setDirection(Vector3(-1, 0, 0));
198        this->tt2_->getEmitter(0)->setPosition(Vector3(-30, 40, -2));
199        this->tt2_->getEmitter(1)->setPosition(Vector3(-30, -40, -2));
200
201        Ogre::SceneNode* node2b = this->getNode()->createChildSceneNode(this->getName() + "particle2b");
202        node2b->setInheritScale(false);
203        node2b->setScale(0.5, 0.5, 0.5);
204        tt2_->addToSceneNode(node2b);
205        // END CREATING THRUSTER
206
207        // START CREATING BLINKING LIGHTS
208        this->redBillboard_.setBillboardSet("Examples/Flare", ColourValue(1.0, 0.0, 0.0), 1);
209        this->greenBillboard_.setBillboardSet("Examples/Flare", ColourValue(0.0, 1.0, 0.0), 1);
210
211        this->redNode_ = this->getNode()->createChildSceneNode(this->getName() + "red", Vector3(0.3, 4.0, -0.3));
212        this->redNode_->setInheritScale(false);
213        this->greenNode_ = this->getNode()->createChildSceneNode(this->getName() + "green", Vector3(0.3, -4.0, -0.3));
214        this->greenNode_->setInheritScale(false);
215
216        this->redNode_->attachObject(this->redBillboard_.getBillboardSet());
217        this->redNode_->setScale(0.3, 0.3, 0.3);
218
219        this->greenNode_->attachObject(this->greenBillboard_.getBillboardSet());
220        this->greenNode_->setScale(0.3, 0.3, 0.3);
221        // END CREATING BLINKING LIGHTS
222
223        if (this->isExactlyA(Class(SpaceShip)))
224        {
225            // START of testing crosshair
226            this->crosshairNear_.setBillboardSet("Orxonox/Crosshair", ColourValue(1.0, 1.0, 0.0), 1);
227            this->crosshairFar_.setBillboardSet("Orxonox/Crosshair", ColourValue(1.0, 1.0, 0.0), 1);
228
229            this->chNearNode_ = this->getNode()->createChildSceneNode(this->getName() + "near", Vector3(50.0, 0.0, 0.0));
230            this->chNearNode_->setInheritScale(false);
231            this->chFarNode_ = this->getNode()->createChildSceneNode(this->getName() + "far", Vector3(200.0, 0.0, 0.0));
232            this->chFarNode_->setInheritScale(false);
233
234            this->chNearNode_->attachObject(this->crosshairNear_.getBillboardSet());
235            this->chNearNode_->setScale(0.2, 0.2, 0.2);
236
237            this->chFarNode_->attachObject(this->crosshairFar_.getBillboardSet());
238            this->chFarNode_->setScale(0.4, 0.4, 0.4);
239        }
240
241        createCamera();
242        // END of testing crosshair
243    }
244
245    void SpaceShip::setConfigValues()
246    {
247        SetConfigValue(bInvertYAxis_, false).description("Set this to true for joystick-like mouse behaviour (mouse up = ship down).");
248        SetConfigValue(reloadTime_, 0.125).description("The reload time of the weapon in seconds");
249        SetConfigValue(testvector_, Vector3()).description("asdfblah");
250    }
251
252    void SpaceShip::changedVisibility()
253    {
254        Model::changedVisibility();
255
256        this->tt1_->setEnabled(this->isVisible());
257        this->tt2_->setEnabled(this->isVisible());
258        this->redBillboard_.setVisible(this->isVisible());
259        this->greenBillboard_.setVisible(this->isVisible());
260        this->crosshairNear_.setVisible(this->isVisible());
261        this->crosshairFar_.setVisible(this->isVisible());
262    }
263
264    void SpaceShip::changedActivity()
265    {
266        Model::changedActivity();
267
268        this->tt1_->setEnabled(this->isVisible());
269        this->tt2_->setEnabled(this->isVisible());
270        this->redBillboard_.setVisible(this->isVisible());
271        this->greenBillboard_.setVisible(this->isVisible());
272        this->crosshairNear_.setVisible(this->isVisible());
273        this->crosshairFar_.setVisible(this->isVisible());
274    }
275
276    void SpaceShip::setCamera(const std::string& camera)
277    {
278      myShip_=true; // TODO: this is only a hack
279      camName_=camera;
280      // change camera attributes here, if you want to ;)
281    }
282
283    void SpaceShip::getFocus(){
284      COUT(4) << "requesting focus" << std::endl;
285      if(network::Client::getSingleton()==0 || network::Client::getSingleton()->getShipID()==objectID)
286        CameraHandler::getInstance()->requestFocus(cam_);
287
288    }
289
290    Camera* SpaceShip::getCamera(){
291        return cam_;
292    }
293
294    void SpaceShip::createCamera(){
295//       COUT(4) << "begin camera creation" << std::endl;
296      this->camNode_ = this->getNode()->createChildSceneNode(camName_);
297      COUT(4) << "position: (this)" << this->getNode()->getPosition() << std::endl;
298      this->camNode_->setPosition(Vector3(-25,0,5));
299//      Quaternion q1 = Quaternion(Radian(Degree(90)),Vector3(0,-1,0));
300//      Quaternion q2 = Quaternion(Radian(Degree(90)),Vector3(0,0,-1));
301//      camNode_->setOrientation(q1*q2);
302      COUT(4) << "position: (cam)" << this->camNode_->getPosition() << std::endl;
303      cam_ = new Camera(this->camNode_);
304
305      cam_->setTargetNode(this->getNode());
306//        cam->setPosition(Vector3(0,-350,0));
307      Quaternion q1 = Quaternion(Radian(Degree(90)),Vector3(0,-1,0));
308      Quaternion q2 = Quaternion(Radian(Degree(90)),Vector3(1,0,0));
309      this->camNode_->setOrientation(q2*q1);
310      if(network::Client::getSingleton()!=0 && network::Client::getSingleton()->getShipID()==objectID){
311        this->setBacksync(true);
312        CameraHandler::getInstance()->requestFocus(cam_);
313      }
314
315    }
316
317    void SpaceShip::setMaxSpeed(float value)
318    { this->maxSpeed_ = value; }
319    void SpaceShip::setMaxSideAndBackSpeed(float value)
320    { this->maxSideAndBackSpeed_ = value; }
321    void SpaceShip::setMaxRotation(float value)
322    { this->maxRotation_ = value; this->maxRotationRadian_ = Radian(value); }
323    void SpaceShip::setTransAcc(float value)
324    { this->translationAcceleration_ = value; }
325    void SpaceShip::setRotAcc(float value)
326    { this->rotationAcceleration_ = value; this->rotationAccelerationRadian_ = Radian(value); }
327    void SpaceShip::setTransDamp(float value)
328    { this->translationDamping_ = value; }
329    void SpaceShip::setRotDamp(float value)
330    { this->rotationDamping_ = value; this->rotationDampingRadian_ = Radian(value); }
331
332    /**
333        @brief XML loading and saving.
334        @param xmlelement The XML-element
335        @param loading Loading (true) or saving (false)
336        @return The XML-element
337    */
338    void SpaceShip::XMLPort(Element& xmlelement, XMLPort::Mode mode)
339    {
340        Model::XMLPort(xmlelement, mode);
341
342        XMLPortParamLoadOnly(SpaceShip, "camera", setCamera, xmlelement, mode);
343        XMLPortParamLoadOnly(SpaceShip, "maxSpeed", setMaxSpeed, xmlelement, mode);
344        XMLPortParamLoadOnly(SpaceShip, "maxSideAndBackSpeed", setMaxSideAndBackSpeed, xmlelement, mode);
345        XMLPortParamLoadOnly(SpaceShip, "maxRotation", setMaxRotation, xmlelement, mode);
346        XMLPortParamLoadOnly(SpaceShip, "transAcc", setTransAcc, xmlelement, mode);
347        XMLPortParamLoadOnly(SpaceShip, "rotAcc", setRotAcc, xmlelement, mode);
348        XMLPortParamLoadOnly(SpaceShip, "transDamp", setTransDamp, xmlelement, mode);
349        XMLPortParamLoadOnly(SpaceShip, "rotDamp", setRotDamp, xmlelement, mode);
350
351        SpaceShip::create();
352        if (this->isExactlyA(Class(SpaceShip)))
353            getFocus();
354    }
355
356    int sgn(float x)
357    {
358        if (x >= 0)
359            return 1;
360        else
361            return -1;
362    }
363
364    std::string SpaceShip::whereAmI() {
365  return getConvertedValue<float, std::string>(SpaceShip::getLocalShip()->getPosition().x)
366  + "  " + getConvertedValue<float, std::string>(SpaceShip::getLocalShip()->getPosition().y)
367  + "  " + getConvertedValue<float, std::string>(SpaceShip::getLocalShip()->getPosition().z);
368    }
369
370    void SpaceShip::tick(float dt)
371    {
372        if (!this->isActive())
373            return;
374
375        currentDir_ = getOrientation()*initialDir_;
376    currentOrth_ = getOrientation()*initialOrth_;
377
378        if (this->cam_)
379            this->cam_->tick(dt);
380
381        if (this->redNode_ && this->greenNode_)
382        {
383            this->blinkTime_ += dt;
384            float redScale = 0.15 + 0.15 * sin(this->blinkTime_ * 10.0);
385            float greenScale = 0.15 - 0.15 * sin(this->blinkTime_ * 10.0);
386            this->redNode_->setScale(redScale, redScale, redScale);
387            this->greenNode_->setScale(greenScale, greenScale, greenScale);
388        }
389
390        if (this->timeToReload_ > 0)
391            this->timeToReload_ -= dt;
392        else
393            this->timeToReload_ = 0;
394
395        if (this->bLMousePressed_ && this->timeToReload_ <= 0)
396        {
397
398            BillboardProjectile* projectile = new ParticleProjectile(this);
399            projectile->setColour(this->getProjectileColour());
400            projectile->create();
401            if (projectile->classID == 0)
402            {
403              COUT(3) << "generated projectile with classid 0" <<  std::endl; // TODO: remove this output
404            }
405
406            projectile->setBacksync(true);
407            this->timeToReload_ = this->reloadTime_;
408        }
409
410
411        // #####################################
412        // ############# STEERING ##############
413        // #####################################
414
415        if (this->velocity_.x > this->maxSpeed_)
416            this->velocity_.x = this->maxSpeed_;
417        if (this->velocity_.x < -this->maxSideAndBackSpeed_)
418            this->velocity_.x = -this->maxSideAndBackSpeed_;
419        if (this->velocity_.y > this->maxSideAndBackSpeed_)
420            this->velocity_.y = this->maxSideAndBackSpeed_;
421        if (this->velocity_.y < -this->maxSideAndBackSpeed_)
422            this->velocity_.y = -this->maxSideAndBackSpeed_;
423        if (this->rotationRate_ > this->maxRotationRadian_)
424            this->rotationRate_ = this->maxRotationRadian_;
425        if (this->rotationRate_ < -this->maxRotationRadian_)
426            this->rotationRate_ = -this->maxRotationRadian_;
427
428        if (this->acceleration_.x == 0)
429        {
430            if (this->velocity_.x > 0)
431            {
432                this->velocity_.x -= (this->translationDamping_ * dt);
433                if (this->velocity_.x < 0)
434                    this->velocity_.x = 0;
435            }
436            else if (this->velocity_.x < 0)
437            {
438                this->velocity_.x += (this->translationDamping_ * dt);
439                if (this->velocity_.x > 0)
440                    this->velocity_.x = 0;
441            }
442        }
443
444        if (this->acceleration_.y == 0)
445        {
446            if (this->velocity_.y > 0)
447            {
448                this->velocity_.y -= (this->translationDamping_ * dt);
449                if (this->velocity_.y < 0)
450                    this->velocity_.y = 0;
451            }
452            else if (this->velocity_.y < 0)
453            {
454                this->velocity_.y += (this->translationDamping_ * dt);
455                if (this->velocity_.y > 0)
456                    this->velocity_.y = 0;
457            }
458        }
459
460        if (this->momentum_ == this->zeroRadian_)
461        {
462            if (this->rotationRate_ > this->zeroRadian_)
463            {
464                this->rotationRate_ -= (this->rotationDampingRadian_ * dt);
465                if (this->rotationRate_ < this->zeroRadian_)
466                    this->rotationRate_ = 0;
467            }
468            else if (this->rotationRate_ < this->zeroRadian_)
469            {
470                this->rotationRate_ += (this->rotationDampingRadian_ * dt);
471                if (this->rotationRate_ > this->zeroRadian_)
472                    this->rotationRate_ = 0;
473            }
474        }
475
476
477        WorldEntity::tick(dt);
478
479        this->roll(this->mouseXRotation_ * dt);
480        if (this->bInvertYAxis_)
481            this->yaw(Radian(-this->mouseYRotation_ * dt));
482        else
483            this->yaw(Radian(this->mouseYRotation_ * dt));
484
485        if (this->acceleration_.x > 0)
486        {
487            this->tt1_->setEnabled(true);
488            this->tt2_->setEnabled(true);
489        }
490        else
491        {
492            this->tt1_->setEnabled(false);
493            this->tt2_->setEnabled(false);
494        }
495
496        if( myShip_ )
497        {
498          COUT(5) << "steering our ship: " << objectID << std::endl;
499          this->acceleration_.x = 0;
500          this->acceleration_.y = 0;
501          this->momentum_ = 0;
502          this->mouseXRotation_ = Radian(0);
503          this->mouseYRotation_ = Radian(0);
504        }/*else
505          COUT(4) << "not steering ship: " << objectID << " our ship: " << network::Client::getSingleton()->getShipID() << std::endl;*/
506
507          this->bLMousePressed_ = false;
508    }
509
510    void SpaceShip::movePitch(float val)
511    {   getLocalShip()->setMovePitch(val);   }
512    void SpaceShip::moveYaw(float val)
513    {   getLocalShip()->setMoveYaw(val);   }
514    void SpaceShip::moveRoll(float val)
515    {   getLocalShip()->setMoveRoll(val);   }
516    void SpaceShip::moveLongitudinal(float val)
517    {   getLocalShip()->setMoveLongitudinal(val);   }
518    void SpaceShip::moveLateral(float val)
519    {   getLocalShip()->setMoveLateral(val);   }
520    void SpaceShip::fire()
521    {   getLocalShip()->doFire();   }
522
523    void SpaceShip::setMovePitch(float val)
524    {
525        val = -val * val * sgn(val) * this->rotationAcceleration_;
526        if (val > this->maxRotation_)
527            val = this->maxRotation_;
528        if (val < -this->maxRotation_)
529            val = -this->maxRotation_;
530        this->mouseYRotation_ = Radian(val);
531    }
532
533    void SpaceShip::setMoveYaw(float val)
534    {
535        val = -val * val * sgn(val) * this->rotationAcceleration_;
536        if (val > this->maxRotation_)
537            val = this->maxRotation_;
538        if (val < -this->maxRotation_)
539            val = -this->maxRotation_;
540        this->mouseXRotation_ = Radian(val);
541    }
542
543    void SpaceShip::setMoveRoll(float val)
544    {
545        this->momentum_ = Radian(-this->rotationAccelerationRadian_ * val);
546        //COUT(3) << "rotating val: " << val << " acceleration: " << this->rotationAccelerationRadian_.valueDegrees() << std::endl;
547    }
548
549    void SpaceShip::setMoveLongitudinal(float val)
550    {
551        this->acceleration_.x = this->translationAcceleration_ * val;
552    }
553
554    void SpaceShip::setMoveLateral(float val)
555    {
556        this->acceleration_.y = -this->translationAcceleration_ * val;
557    }
558
559    void SpaceShip::doFire()
560    {
561        this->bLMousePressed_ = true;
562    }
563}
Note: See TracBrowser for help on using the repository browser.