[Orxonox-commit 6956] r11577 - code/branches/SOBv2_HS17/src/modules/superorxobros

zarron at orxonox.net zarron at orxonox.net
Mon Nov 20 16:05:28 CET 2017


Author: zarron
Date: 2017-11-20 16:05:27 +0100 (Mon, 20 Nov 2017)
New Revision: 11577

Modified:
   code/branches/SOBv2_HS17/src/modules/superorxobros/SOBFigure.cc
   code/branches/SOBv2_HS17/src/modules/superorxobros/SOBFireball.cc
   code/branches/SOBv2_HS17/src/modules/superorxobros/SOBFireball.h
Log:
first atempt to set dir of fireballs correctly

Modified: code/branches/SOBv2_HS17/src/modules/superorxobros/SOBFigure.cc
===================================================================
--- code/branches/SOBv2_HS17/src/modules/superorxobros/SOBFigure.cc	2017-11-20 14:26:31 UTC (rev 11576)
+++ code/branches/SOBv2_HS17/src/modules/superorxobros/SOBFigure.cc	2017-11-20 15:05:27 UTC (rev 11577)
@@ -38,6 +38,7 @@
 #include "graphics/Model.h"
 #include "graphics/Camera.h"
 #include "graphics/ParticleSpawner.h"
+#include <OgreMath.h>
 
 #include "SOBMushroom.h"
 #include "SOBGumba.h"
@@ -155,7 +156,7 @@
     }
 
         else if (fireball != nullptr && !(fireball->hasCollided_)){
-            this-> die();
+            //this-> die();
         }
 
     //Purpose is that if player hits the flag, he should walk into the castle at the end of the level. For that we use SOBCastlestone
@@ -196,7 +197,11 @@
         {
             ball->addTemplate("fireball");
             ball->setPosition(spawnpos);
-            
+            bool direction = ((this->getWorldOrientation().getRoll().valueRadians())>-1.6&&(this->getWorldOrientation().getRoll().valueRadians()<1.6));
+            ball->setDirection(direction);
+            orxout() << "Rotation: " << this->getWorldOrientation().getRoll() << " direction: "<< direction <<endl;
+            //ball->
+
         }
      }
 

Modified: code/branches/SOBv2_HS17/src/modules/superorxobros/SOBFireball.cc
===================================================================
--- code/branches/SOBv2_HS17/src/modules/superorxobros/SOBFireball.cc	2017-11-20 14:26:31 UTC (rev 11576)
+++ code/branches/SOBv2_HS17/src/modules/superorxobros/SOBFireball.cc	2017-11-20 15:05:27 UTC (rev 11577)
@@ -80,6 +80,18 @@
 
     }
 
+    void SOBFireball::setDirection(const bool direction)
+    {
+        if(direction)
+        {
+            goesRight_=true;
+        }
+        else
+        {
+            goesRight_=false;
+        }
+    }
+
     
     bool SOBFireball::collidesAgainst(WorldEntity* otherObject, const btCollisionShape* ownCollisionShape, btManifoldPoint& contactPoint) {
         collDisX_ = getPosition().x - contactPoint.getPositionWorldOnB().getX();

Modified: code/branches/SOBv2_HS17/src/modules/superorxobros/SOBFireball.h
===================================================================
--- code/branches/SOBv2_HS17/src/modules/superorxobros/SOBFireball.h	2017-11-20 14:26:31 UTC (rev 11576)
+++ code/branches/SOBv2_HS17/src/modules/superorxobros/SOBFireball.h	2017-11-20 15:05:27 UTC (rev 11577)
@@ -52,7 +52,7 @@
             virtual void setFigure(SOBFigure* newFigure);
             virtual bool collidesAgainst(WorldEntity* otherObject, const btCollisionShape* ownCollisionShape, btManifoldPoint& contactPoint) override;
             virtual void tick(float dt) override;
-
+            void setDirection(const bool direction);
           
             bool attachedToFigure_;
 



More information about the Orxonox-commit mailing list