[Orxonox-commit 5345] r10008 - in code/branches/turretFS14: data/levels data/levels/templates src/modules/objects src/modules/objects/controllers

muemart at orxonox.net muemart at orxonox.net
Thu Mar 27 15:52:59 CET 2014


Author: muemart
Date: 2014-03-27 15:52:59 +0100 (Thu, 27 Mar 2014)
New Revision: 10008

Added:
   code/branches/turretFS14/src/modules/objects/controllers/
   code/branches/turretFS14/src/modules/objects/controllers/CMakeLists.txt
   code/branches/turretFS14/src/modules/objects/controllers/TurretController.cc
   code/branches/turretFS14/src/modules/objects/controllers/TurretController.h
Modified:
   code/branches/turretFS14/data/levels/templates/spaceshipTurretTest.oxt
   code/branches/turretFS14/data/levels/turretTest.oxw
   code/branches/turretFS14/src/modules/objects/CMakeLists.txt
   code/branches/turretFS14/src/modules/objects/Turret.cc
   code/branches/turretFS14/src/modules/objects/Turret.h
Log:
Start a new controller and investigate rotations

Modified: code/branches/turretFS14/data/levels/templates/spaceshipTurretTest.oxt
===================================================================
--- code/branches/turretFS14/data/levels/templates/spaceshipTurretTest.oxt	2014-03-27 14:49:50 UTC (rev 10007)
+++ code/branches/turretFS14/data/levels/templates/spaceshipTurretTest.oxt	2014-03-27 14:52:59 UTC (rev 10008)
@@ -38,7 +38,7 @@
    angularDamping    = 0.9999999
   >
     <attached>
-        <Model position="0,0,0" yaw="90" roll="-90" mesh="turretHead.mesh" scale3D="10,10,10"/>
+        <Model position="0,0,0" pitch="0" roll="0" mesh="turretHead.mesh" scale3D="10,10,10"/>
     </attached>
     <collisionShapes>
         <SphereCollisionShape radius="10"   position = "0,0,0"/>

Modified: code/branches/turretFS14/data/levels/turretTest.oxw
===================================================================
--- code/branches/turretFS14/data/levels/turretTest.oxw	2014-03-27 14:49:50 UTC (rev 10007)
+++ code/branches/turretFS14/data/levels/turretTest.oxw	2014-03-27 14:52:59 UTC (rev 10008)
@@ -40,23 +40,28 @@
         <Model position="0,0,0" mesh="turretSocketTop.mesh" scale3D="10,10,10" />
         <Model position="0,0,0" mesh="turretSocketLeft.mesh" scale3D="10,10,10" />
         <Model position="0,0,0" mesh="turretSocketRight.mesh" scale3D="10,10,10" />
+
+        <Turret position="0,10,0" pitch="0" yaw="90" roll="0">
+            <templates>
+              <Template link=spaceshipturrettest />
+            </templates>
+            <controller>
+              <TurretController team=10 />
+            </controller>
+        </Turret>
+
+        <Model mesh="sphere.mesh" position="25,0,0" scale=1 />
+
+        <Model mesh="sphere.mesh" position="0,25,0" scale=1 />
+
+        <Model mesh="sphere.mesh" position="0,0,25" scale=1 />
+
     </attached>
 </StaticEntity>
 
 
 
-<Turret position="0,10,0" pitch="90" yaw="0" roll="0">
-    <templates>
-        <Template link=spaceshipturrettest />
-    </templates>
-    <controller>
-        <WaypointPatrolController alertnessradius=100 team=10>
-        </WaypointPatrolController>
-     </controller>
-</Turret>
 
-
-
     
   </Scene>
 </Level>

Modified: code/branches/turretFS14/src/modules/objects/CMakeLists.txt
===================================================================
--- code/branches/turretFS14/src/modules/objects/CMakeLists.txt	2014-03-27 14:49:50 UTC (rev 10007)
+++ code/branches/turretFS14/src/modules/objects/CMakeLists.txt	2014-03-27 14:52:59 UTC (rev 10008)
@@ -10,6 +10,7 @@
 ADD_SUBDIRECTORY(collisionshapes)
 ADD_SUBDIRECTORY(eventsystem)
 ADD_SUBDIRECTORY(triggers)
+ADD_SUBDIRECTORY(controllers)
 
 ORXONOX_ADD_LIBRARY(objects
   MODULE

Modified: code/branches/turretFS14/src/modules/objects/Turret.cc
===================================================================
--- code/branches/turretFS14/src/modules/objects/Turret.cc	2014-03-27 14:49:50 UTC (rev 10007)
+++ code/branches/turretFS14/src/modules/objects/Turret.cc	2014-03-27 14:52:59 UTC (rev 10008)
@@ -77,10 +77,10 @@
         if(currentPitch > upperBoundary && value.x > 0 ||
            currentPitch < lowerBoundary && value.x < 0)
         {
-            return;
+            //return;
         }
         
-        //SpaceShip::rotatePitch(value);
+        SpaceShip::rotatePitch(value);
     }
 
     void Turret::rotateYaw(const Vector2& value)
@@ -91,7 +91,6 @@
         Radian limit = Radian(Degree(45));
         Radian upperBoundary = startYaw + limit;
         Radian lowerBoundary = startYaw - limit;
-        orxout() << currentYaw << " " << this->getOrientation().getRoll() << endl;
         /*if(upperBoundary >= Radian(Degree(180)));
         {
             upperBoundary -= Radian(Degree(180));
@@ -116,7 +115,7 @@
 
     void Turret::rotateRoll(const Vector2& value)
     {
-        return;
+        SpaceShip::rotateRoll(value);
     }
 
     void Turret::setAlertnessRadius(float value)
@@ -136,6 +135,7 @@
 
     void Turret::tick(float dt)
     {
+        orxout() << "Pitch: " << this->getOrientation().getPitch() << "\tYaw: " << this->getOrientation().getYaw() << "\tRoll: " << this->getOrientation().getRoll() << endl;
         if(!gotOrient_)
         {
             startOrient_ = this->getOrientation();

Modified: code/branches/turretFS14/src/modules/objects/Turret.h
===================================================================
--- code/branches/turretFS14/src/modules/objects/Turret.h	2014-03-27 14:49:50 UTC (rev 10007)
+++ code/branches/turretFS14/src/modules/objects/Turret.h	2014-03-27 14:52:59 UTC (rev 10008)
@@ -64,7 +64,6 @@
         private:
             bool gotOrient_;
             Quaternion startOrient_;
-            Quaternion firstOrient_;
     };
 }
 

Added: code/branches/turretFS14/src/modules/objects/controllers/CMakeLists.txt
===================================================================
--- code/branches/turretFS14/src/modules/objects/controllers/CMakeLists.txt	                        (rev 0)
+++ code/branches/turretFS14/src/modules/objects/controllers/CMakeLists.txt	2014-03-27 14:52:59 UTC (rev 10008)
@@ -0,0 +1,3 @@
+ADD_SOURCE_FILES(OBJECTS_SRC_FILES
+  TurretController.cc
+)

Added: code/branches/turretFS14/src/modules/objects/controllers/TurretController.cc
===================================================================
--- code/branches/turretFS14/src/modules/objects/controllers/TurretController.cc	                        (rev 0)
+++ code/branches/turretFS14/src/modules/objects/controllers/TurretController.cc	2014-03-27 14:52:59 UTC (rev 10008)
@@ -0,0 +1,49 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Martin Mueller
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+ #include "TurretController.h"
+
+ namespace orxonox
+ {
+ 	RegisterClass(TurretController);
+
+ 	TurretController::TurretController(Context* context) : ArtificialController(context)
+ 	{
+ 		RegisterObject(TurretController);
+ 	}
+
+ 	TurretController::~TurretController()
+ 	{
+
+ 	}
+
+ 	void TurretController::tick(float dt)
+ 	{
+ 		this->getControllableEntity()->rotateYaw(10*dt);
+ 	}
+ }
\ No newline at end of file

Added: code/branches/turretFS14/src/modules/objects/controllers/TurretController.h
===================================================================
--- code/branches/turretFS14/src/modules/objects/controllers/TurretController.h	                        (rev 0)
+++ code/branches/turretFS14/src/modules/objects/controllers/TurretController.h	2014-03-27 14:52:59 UTC (rev 10008)
@@ -0,0 +1,47 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Martin Mueller
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+ #ifndef _TurretController_H__
+ #define _TurretController_H__
+
+#include "OrxonoxPrereqs.h"
+#include "controllers/ArtificialController.h"
+
+ namespace orxonox
+ {
+ 	class _OrxonoxExport TurretController : public ArtificialController, public Tickable
+ 	{
+ 		public:
+ 			TurretController(Context* context);
+ 			virtual ~TurretController();
+
+ 			virtual void tick(float dt);
+ 	};
+ }
+
+ #endif
\ No newline at end of file




More information about the Orxonox-commit mailing list