[Orxonox-commit 7389] r12006 - in code/branches/ScriptableController_FS18: data/levels data/levels/scripts data/levels/templates src/orxonox src/orxonox/scriptablecontroller src/orxonox/worldentities/pawns
adamc at orxonox.net
adamc at orxonox.net
Thu May 24 16:42:44 CEST 2018
Author: adamc
Date: 2018-05-24 16:42:43 +0200 (Thu, 24 May 2018)
New Revision: 12006
Added:
code/branches/ScriptableController_FS18/data/levels/ScriptableControllerTestMoveKillDrone.oxw
code/branches/ScriptableController_FS18/data/levels/ScriptableControllerTestSpawn.oxw
code/branches/ScriptableController_FS18/data/levels/scripts/ScriptableControllerMoveKill.lua
code/branches/ScriptableController_FS18/data/levels/scripts/ScriptableControllerSpawn.lua
code/branches/ScriptableController_FS18/data/levels/templates/ScriptableControllerDroneTemplate.oxt
code/branches/ScriptableController_FS18/src/orxonox/worldentities/pawns/ScriptableControllerDrone.cc
code/branches/ScriptableController_FS18/src/orxonox/worldentities/pawns/ScriptableControllerDrone.h
Removed:
code/branches/ScriptableController_FS18/data/levels/AAAScriptableControllerTest.oxw
code/branches/ScriptableController_FS18/data/levels/BBBScriptableControllerTest.oxw
code/branches/ScriptableController_FS18/data/levels/scripts/AAAScriptableControllerTest.lua
code/branches/ScriptableController_FS18/data/levels/scripts/BBBScriptableControllerTest.lua
code/branches/ScriptableController_FS18/data/levels/templates/AAAAutonomousDroneTemplate.oxt
code/branches/ScriptableController_FS18/src/orxonox/worldentities/pawns/AAAAutonomousDrone.cc
code/branches/ScriptableController_FS18/src/orxonox/worldentities/pawns/AAAAutonomousDrone.h
Modified:
code/branches/ScriptableController_FS18/src/orxonox/Level.cc
code/branches/ScriptableController_FS18/src/orxonox/scriptablecontroller/scriptable_controller_api.cc
code/branches/ScriptableController_FS18/src/orxonox/worldentities/pawns/CMakeLists.txt
Log:
first final draft
Deleted: code/branches/ScriptableController_FS18/data/levels/AAAScriptableControllerTest.oxw
===================================================================
--- code/branches/ScriptableController_FS18/data/levels/AAAScriptableControllerTest.oxw 2018-05-24 14:32:19 UTC (rev 12005)
+++ code/branches/ScriptableController_FS18/data/levels/AAAScriptableControllerTest.oxw 2018-05-24 14:42:43 UTC (rev 12006)
@@ -1,42 +0,0 @@
-<LevelInfo
- name = "Scriptable Controller Moving and Killing Pawn"
- description = "Demonstrates moving and killing a drone by using a lua script."
- tags = "test"
- screenshot = "emptylevel.png"
-/>
-
-<?lua
- include("stats.oxo")
- include("HUDTemplates3.oxo")
- include("templates/lodInformation.oxt")
- include("templates/HeavyCruiser.oxt")
-?>
-
-<?lua
- include("templates/spaceshipEscort.oxt")
- include("templates/endurancetest_template.oxt")
- include("templates/AAAAutonomousDroneTemplate.oxt")
-?>
-
-<Level script="scripts/AAAScriptableControllerTest.lua">
- <templates>
- <Template link=lodtemplate_default />
- </templates>
- <?lua include("includes/notifications.oxi") ?>
-
- <Scene
- ambientlight = "0.8, 0.8, 0.8"
- skybox = "Orxonox/Starbox"
- >
-
- <Light type=directional position="0,0,0" direction="0.253, 0.593, -0.765" diffuse="1.0, 0.9, 0.9, 1.0" specular="1.0, 0.9, 0.9, 1.0"/>
- <SpawnPoint team=0 position="100,0,0" lookat="0,0,0" spawnclass=SpaceShip pawndesign=spaceshipescort />
- <!-- <SpawnPoint team=2 position="0,0,0" lookat="0,0,0" spawnclass=AAAAutonomousDrone pawndesign=AAAAutonomousDroneTemplate /> -->
-
-
-
-
-
-
- </Scene>
-</Level>
Deleted: code/branches/ScriptableController_FS18/data/levels/BBBScriptableControllerTest.oxw
===================================================================
--- code/branches/ScriptableController_FS18/data/levels/BBBScriptableControllerTest.oxw 2018-05-24 14:32:19 UTC (rev 12005)
+++ code/branches/ScriptableController_FS18/data/levels/BBBScriptableControllerTest.oxw 2018-05-24 14:42:43 UTC (rev 12006)
@@ -1,48 +0,0 @@
-<LevelInfo
- name = "Scriptable Controller Spawning Pawn"
- description = "Demonstrates spawning a drone by using a lua script."
- tags = "test"
- screenshot = "emptylevel.png"
-/>
-
-<?lua
- include("stats.oxo")
- include("HUDTemplates3.oxo")
- include("templates/lodInformation.oxt")
- include("templates/HeavyCruiser.oxt")
-?>
-
-<?lua
- include("templates/spaceshipEscort.oxt")
- include("templates/endurancetest_template.oxt")
-?>
-
-<Level script="scripts/BBBScriptableControllerTest.lua">
- <templates>
- <Template link=lodtemplate_default />
- </templates>
- <?lua include("includes/notifications.oxi") ?>
-
- <Scene
- ambientlight = "0.8, 0.8, 0.8"
- skybox = "Orxonox/Starbox"
- >
-
- <Light type=directional position="0,0,0" direction="0.253, 0.593, -0.765" diffuse="1.0, 0.9, 0.9, 1.0" specular="1.0, 0.9, 0.9, 1.0"/>
- <SpawnPoint team=0 position="100,0,0" lookat="0,0,0" spawnclass=SpaceShip pawndesign=spaceshipescort />
-
-
- <AAAAutonomousDrone id="dummy" position="0,0,0">
- <attached>
- <Model scale="10" mesh="drone.mesh"/>
- </attached>
- <collisionShapes>
- <BoxCollisionShape position="0,0,0" halfExtents="10, 10, 10" />
- </collisionShapes>
- </AAAAutonomousDrone>
-
-
-
-
- </Scene>
-</Level>
Copied: code/branches/ScriptableController_FS18/data/levels/ScriptableControllerTestMoveKillDrone.oxw (from rev 11999, code/branches/ScriptableController_FS18/data/levels/BBBScriptableControllerTest.oxw)
===================================================================
--- code/branches/ScriptableController_FS18/data/levels/ScriptableControllerTestMoveKillDrone.oxw (rev 0)
+++ code/branches/ScriptableController_FS18/data/levels/ScriptableControllerTestMoveKillDrone.oxw 2018-05-24 14:42:43 UTC (rev 12006)
@@ -0,0 +1,48 @@
+<LevelInfo
+ name = "Scriptable Controller Moving and Killing Pawn"
+ description = "Demonstrates moving and killing a drone by using a lua script."
+ tags = "test"
+ screenshot = "emptylevel.png"
+/>
+
+<?lua
+ include("stats.oxo")
+ include("HUDTemplates3.oxo")
+ include("templates/lodInformation.oxt")
+ include("templates/HeavyCruiser.oxt")
+?>
+
+<?lua
+ include("templates/spaceshipEscort.oxt")
+ include("templates/endurancetest_template.oxt")
+?>
+
+<Level script="scripts/ScriptableControllerMoveKill.lua">
+ <templates>
+ <Template link=lodtemplate_default />
+ </templates>
+ <?lua include("includes/notifications.oxi") ?>
+
+ <Scene
+ ambientlight = "0.8, 0.8, 0.8"
+ skybox = "Orxonox/Starbox"
+ >
+
+ <Light type=directional position="0,0,0" direction="0.253, 0.593, -0.765" diffuse="1.0, 0.9, 0.9, 1.0" specular="1.0, 0.9, 0.9, 1.0"/>
+ <SpawnPoint team=0 position="100,0,0" lookat="0,0,0" spawnclass=SpaceShip pawndesign=spaceshipescort />
+
+
+ <ScriptableControllerDrone id="dummy" position="0,0,0">
+ <attached>
+ <Model scale="10" mesh="drone.mesh"/>
+ </attached>
+ <collisionShapes>
+ <BoxCollisionShape position="0,0,0" halfExtents="10, 10, 10" />
+ </collisionShapes>
+ </ScriptableControllerDrone>
+
+
+
+
+ </Scene>
+</Level>
Copied: code/branches/ScriptableController_FS18/data/levels/ScriptableControllerTestSpawn.oxw (from rev 11999, code/branches/ScriptableController_FS18/data/levels/AAAScriptableControllerTest.oxw)
===================================================================
--- code/branches/ScriptableController_FS18/data/levels/ScriptableControllerTestSpawn.oxw (rev 0)
+++ code/branches/ScriptableController_FS18/data/levels/ScriptableControllerTestSpawn.oxw 2018-05-24 14:42:43 UTC (rev 12006)
@@ -0,0 +1,41 @@
+<LevelInfo
+ name = "Scriptable Controller Spawning Pawn"
+ description = "Demonstrates spawning a drone by using a lua script."
+ tags = "test"
+ screenshot = "emptylevel.png"
+/>
+
+<?lua
+ include("stats.oxo")
+ include("HUDTemplates3.oxo")
+ include("templates/lodInformation.oxt")
+ include("templates/HeavyCruiser.oxt")
+?>
+
+<?lua
+ include("templates/spaceshipEscort.oxt")
+ include("templates/endurancetest_template.oxt")
+ include("templates/ScriptableControllerDroneTemplate.oxt")
+?>
+
+<Level script="scripts/ScriptableControllerSpawn.lua">
+ <templates>
+ <Template link=lodtemplate_default />
+ </templates>
+ <?lua include("includes/notifications.oxi") ?>
+
+ <Scene
+ ambientlight = "0.8, 0.8, 0.8"
+ skybox = "Orxonox/Starbox"
+ >
+
+ <Light type=directional position="0,0,0" direction="0.253, 0.593, -0.765" diffuse="1.0, 0.9, 0.9, 1.0" specular="1.0, 0.9, 0.9, 1.0"/>
+ <SpawnPoint team=0 position="100,0,0" lookat="0,0,0" spawnclass=SpaceShip pawndesign=spaceshipescort />
+
+
+
+
+
+
+ </Scene>
+</Level>
Deleted: code/branches/ScriptableController_FS18/data/levels/scripts/AAAScriptableControllerTest.lua
===================================================================
--- code/branches/ScriptableController_FS18/data/levels/scripts/AAAScriptableControllerTest.lua 2018-05-24 14:32:19 UTC (rev 12005)
+++ code/branches/ScriptableController_FS18/data/levels/scripts/AAAScriptableControllerTest.lua 2018-05-24 14:42:43 UTC (rev 12006)
@@ -1,110 +0,0 @@
-
-rotate_factor = 0.0
-station_loc = 200.0
-station_speed = 0.0
-
-id = "dummy"
-
-
-function spawn_station(obj)
- orxPrint("Spawning station")
- setPosition("Station", 500, 0, 0)
- setOrientation("Station", 0, -1, 0, 0)
-end
-
-
-function rotate_faster(obj1, obj2, health, shield)
- orxPrint("Rotating station faster")
-
- rotate_factor = rotate_factor + 0.02
- setAngularVelocity("Station", rotate_factor, 0, 0)
-end
-
-
-function kill_player()
- orxPrint("Killing player")
- killPawn("Player")
-end
-
-
-function kill_player_after_timeout(pawn)
- orxPrint("Killing player after 5s")
-
- registerAfterTimeout(kill_player, 5)
-end
-
-
-function next_station_loc(obj1, obj2)
- orxPrint("Moving station")
-
- station_loc = station_loc + 500
- setPosition("Station", station_loc, 0, 0)
-
- station_speed = station_speed + 5
- setVelocity("Station", -station_speed, 0, 0)
-
- registerAtNearObject(next_station_loc, "Player", "Station", 200)
-end
-
-
-function kill_player()
- orxPrint("Killing player")
- killPawn("Player")
-end
-
-
-function kill_dummy()
- orxPrint("Killing dummy!")
- killPawn(id)
-end
-
-
-function spawn_dummy()
- orxPrint("Spawning dummy!")
- spawnTest("dummy")
- move_dummy()
-end
-
-
-function kill_player_after_timeout(pawn)
- orxPrint("Killing player after 5s")
-
- registerAfterTimeout(kill_player, 5)
-end
-
-
-function kill_dummy_after_timeout(seconds)
- orxPrint("Killing dummy after " .. tostring(seconds))
- registerAfterTimeout(kill_dummy, seconds)
-end
-
-
-function move_dummy()
- orxPrint("Moving dummy!")
- moveControllableEntity(id, 1.0, 0.0, 0.0)
-end
-
-
-function move_dummy_after_timeout(seconds)
- orxPrint("Moving dummy after " .. tostring(seconds))
-
- registerAfterTimeout(move_dummy, seconds)
-end
-
-
-function spawn_dummy_after_timeout(seconds)
- orxPrint("Spawning dummy after " .. tostring(seconds))
- registerAfterTimeout(spawn_dummy, seconds)
-end
-
-
-
-
-orxPrint("Script started! OMG ROFL LOL WTF")
-mytestfunction(3.0, 4.0)
-
-
-spawn_dummy_after_timeout(5)
-
-
-
Deleted: code/branches/ScriptableController_FS18/data/levels/scripts/BBBScriptableControllerTest.lua
===================================================================
--- code/branches/ScriptableController_FS18/data/levels/scripts/BBBScriptableControllerTest.lua 2018-05-24 14:32:19 UTC (rev 12005)
+++ code/branches/ScriptableController_FS18/data/levels/scripts/BBBScriptableControllerTest.lua 2018-05-24 14:42:43 UTC (rev 12006)
@@ -1,51 +0,0 @@
-
-id = "dummy"
-
-
-function kill_player()
- orxPrint("Killing player")
- killPawn("Player")
-end
-
-
-function kill_dummy()
- orxPrint("Killing dummy!")
- killPawn(id)
-end
-
-
-function kill_player_after_timeout(pawn)
- orxPrint("Killing player after 5s")
-
- registerAfterTimeout(kill_player, 5)
-end
-
-
-function kill_dummy_after_timeout(seconds)
- orxPrint("Killing dummy after " .. tostring(seconds))
- registerAfterTimeout(kill_dummy, seconds)
-end
-
-
-function move_dummy()
- orxPrint("Moving dummy!")
- moveControllableEntity(id, 1.0, 0.0, 0.0)
-end
-
-
-function move_dummy_after_timeout(seconds)
- orxPrint("Moving dummy after " .. tostring(seconds))
- registerAfterTimeout(move_dummy, seconds)
-end
-
-
-
-
-move_dummy_after_timeout(5)
-kill_dummy_after_timeout(10)
-
-
-orxPrint("Script started! OMG ROFL LOL WTF")
-mytestfunction(3.0, 4.0)
-
-
Copied: code/branches/ScriptableController_FS18/data/levels/scripts/ScriptableControllerMoveKill.lua (from rev 11961, code/branches/ScriptableController_FS18/data/levels/scripts/BBBScriptableControllerTest.lua)
===================================================================
--- code/branches/ScriptableController_FS18/data/levels/scripts/ScriptableControllerMoveKill.lua (rev 0)
+++ code/branches/ScriptableController_FS18/data/levels/scripts/ScriptableControllerMoveKill.lua 2018-05-24 14:42:43 UTC (rev 12006)
@@ -0,0 +1,51 @@
+
+id = "dummy"
+
+
+function kill_player()
+ orxPrint("Killing player")
+ killPawn("Player")
+end
+
+
+function kill_dummy()
+ orxPrint("Killing dummy!")
+ killPawn(id)
+end
+
+
+function kill_player_after_timeout(pawn)
+ orxPrint("Killing player after 5s")
+
+ registerAfterTimeout(kill_player, 5)
+end
+
+
+function kill_dummy_after_timeout(seconds)
+ orxPrint("Killing dummy after " .. tostring(seconds))
+ registerAfterTimeout(kill_dummy, seconds)
+end
+
+
+function move_dummy()
+ orxPrint("Moving dummy!")
+ moveControllableEntity(id, 1.0, 0.0, 0.0)
+end
+
+
+function move_dummy_after_timeout(seconds)
+ orxPrint("Moving dummy after " .. tostring(seconds))
+ registerAfterTimeout(move_dummy, seconds)
+end
+
+
+
+
+move_dummy_after_timeout(5)
+kill_dummy_after_timeout(10)
+
+
+orxPrint("Script started! OMG ROFL LOL WTF")
+mytestfunction(3.0, 4.0)
+
+
Copied: code/branches/ScriptableController_FS18/data/levels/scripts/ScriptableControllerSpawn.lua (from rev 11999, code/branches/ScriptableController_FS18/data/levels/scripts/AAAScriptableControllerTest.lua)
===================================================================
--- code/branches/ScriptableController_FS18/data/levels/scripts/ScriptableControllerSpawn.lua (rev 0)
+++ code/branches/ScriptableController_FS18/data/levels/scripts/ScriptableControllerSpawn.lua 2018-05-24 14:42:43 UTC (rev 12006)
@@ -0,0 +1,110 @@
+
+rotate_factor = 0.0
+station_loc = 200.0
+station_speed = 0.0
+
+id = "dummy"
+
+
+function spawn_station(obj)
+ orxPrint("Spawning station")
+ setPosition("Station", 500, 0, 0)
+ setOrientation("Station", 0, -1, 0, 0)
+end
+
+
+function rotate_faster(obj1, obj2, health, shield)
+ orxPrint("Rotating station faster")
+
+ rotate_factor = rotate_factor + 0.02
+ setAngularVelocity("Station", rotate_factor, 0, 0)
+end
+
+
+function kill_player()
+ orxPrint("Killing player")
+ killPawn("Player")
+end
+
+
+function kill_player_after_timeout(pawn)
+ orxPrint("Killing player after 5s")
+
+ registerAfterTimeout(kill_player, 5)
+end
+
+
+function next_station_loc(obj1, obj2)
+ orxPrint("Moving station")
+
+ station_loc = station_loc + 500
+ setPosition("Station", station_loc, 0, 0)
+
+ station_speed = station_speed + 5
+ setVelocity("Station", -station_speed, 0, 0)
+
+ registerAtNearObject(next_station_loc, "Player", "Station", 200)
+end
+
+
+function kill_player()
+ orxPrint("Killing player")
+ killPawn("Player")
+end
+
+
+function kill_dummy()
+ orxPrint("Killing dummy!")
+ killPawn(id)
+end
+
+
+function spawn_dummy()
+ orxPrint("Spawning dummy!")
+ spawnTest("dummy")
+ move_dummy()
+end
+
+
+function kill_player_after_timeout(pawn)
+ orxPrint("Killing player after 5s")
+
+ registerAfterTimeout(kill_player, 5)
+end
+
+
+function kill_dummy_after_timeout(seconds)
+ orxPrint("Killing dummy after " .. tostring(seconds))
+ registerAfterTimeout(kill_dummy, seconds)
+end
+
+
+function move_dummy()
+ orxPrint("Moving dummy!")
+ moveControllableEntity(id, 1.0, 0.0, 0.0)
+end
+
+
+function move_dummy_after_timeout(seconds)
+ orxPrint("Moving dummy after " .. tostring(seconds))
+
+ registerAfterTimeout(move_dummy, seconds)
+end
+
+
+function spawn_dummy_after_timeout(seconds)
+ orxPrint("Spawning dummy after " .. tostring(seconds))
+ registerAfterTimeout(spawn_dummy, seconds)
+end
+
+
+
+
+orxPrint("Script started! OMG ROFL LOL WTF")
+mytestfunction(3.0, 4.0)
+
+
+spawn_dummy_after_timeout(5)
+
+
+
Deleted: code/branches/ScriptableController_FS18/data/levels/templates/AAAAutonomousDroneTemplate.oxt
===================================================================
--- code/branches/ScriptableController_FS18/data/levels/templates/AAAAutonomousDroneTemplate.oxt 2018-05-24 14:32:19 UTC (rev 12005)
+++ code/branches/ScriptableController_FS18/data/levels/templates/AAAAutonomousDroneTemplate.oxt 2018-05-24 14:42:43 UTC (rev 12006)
@@ -1,10 +0,0 @@
-<Template name=AAAAutonomousDroneTemplate>
- <AAAAutonomousDrone>
- <attached>
- <Model scale="10" mesh="drone.mesh"/>
- </attached>
- <collisionShapes>
- <BoxCollisionShape position="0,0,0" halfExtents="10, 10, 10" />
- </collisionShapes>
- </AAAAutonomousDrone>
-</Template>
\ No newline at end of file
Copied: code/branches/ScriptableController_FS18/data/levels/templates/ScriptableControllerDroneTemplate.oxt (from rev 11999, code/branches/ScriptableController_FS18/data/levels/templates/AAAAutonomousDroneTemplate.oxt)
===================================================================
--- code/branches/ScriptableController_FS18/data/levels/templates/ScriptableControllerDroneTemplate.oxt (rev 0)
+++ code/branches/ScriptableController_FS18/data/levels/templates/ScriptableControllerDroneTemplate.oxt 2018-05-24 14:42:43 UTC (rev 12006)
@@ -0,0 +1,10 @@
+<Template name=ScriptableControllerDroneTemplate>
+ <ScriptableControllerDrone>
+ <attached>
+ <Model scale="10" mesh="drone.mesh"/>
+ </attached>
+ <collisionShapes>
+ <BoxCollisionShape position="0,0,0" halfExtents="10, 10, 10" />
+ </collisionShapes>
+ </ScriptableControllerDrone>
+</Template>
\ No newline at end of file
Modified: code/branches/ScriptableController_FS18/src/orxonox/Level.cc
===================================================================
--- code/branches/ScriptableController_FS18/src/orxonox/Level.cc 2018-05-24 14:32:19 UTC (rev 12005)
+++ code/branches/ScriptableController_FS18/src/orxonox/Level.cc 2018-05-24 14:42:43 UTC (rev 12006)
@@ -57,7 +57,6 @@
this->xmlfilename_ = this->getFilename();
this->xmlfile_ = nullptr;
this->controller_.reset(new ScriptableController());
- this->controller_->level_ = this;
}
Level::~Level()
Modified: code/branches/ScriptableController_FS18/src/orxonox/scriptablecontroller/scriptable_controller_api.cc
===================================================================
--- code/branches/ScriptableController_FS18/src/orxonox/scriptablecontroller/scriptable_controller_api.cc 2018-05-24 14:32:19 UTC (rev 12005)
+++ code/branches/ScriptableController_FS18/src/orxonox/scriptablecontroller/scriptable_controller_api.cc 2018-05-24 14:42:43 UTC (rev 12006)
@@ -8,7 +8,7 @@
#include "worldentities/pawns/ModularSpaceShip.h"
//#include "../modules/objects/collisionshapes/SphereCollisionShape.h"
#include "graphics/Model.h"
-#include "worldentities/pawns/AAAAutonomousDrone.h"
+#include "worldentities/pawns/ScriptableControllerDrone.h"
namespace orxonox
@@ -209,7 +209,7 @@
}
- Identifier *identifier = ClassByString("AAAAutonomousDrone");
+ Identifier *identifier = ClassByString("ScriptableControllerDrone");
if(!identifier)
@@ -276,9 +276,9 @@
///////////////GOLD!!!!!!!!!!!!!!!////////////////////////
Pawn* pawn = this->controller_->getPawnByID(id);
//Attach to pawn
- AAAAutonomousDrone* drone = new AAAAutonomousDrone(pawn->getContext()); // this is neccessary because the projectiles fired need a valid creator for the particlespawner (when colliding against something)
+ ScriptableControllerDrone* drone = new ScriptableControllerDrone(pawn->getContext()); // this is neccessary because the projectiles fired need a valid creator for the particlespawner (when colliding against something)
- drone->addTemplate("AAAAutonomousDroneTemplate"); //AAAAutonomousDroneTemplate spaceshipescort
+ drone->addTemplate("ScriptableControllerDroneTemplate"); //ScriptableControllerDroneTemplate spaceshipescort
Vector3 spawnPosition = pawn->getWorldPosition() + Vector3(30,0,-30);
drone->setPosition(spawnPosition);
Deleted: code/branches/ScriptableController_FS18/src/orxonox/worldentities/pawns/AAAAutonomousDrone.cc
===================================================================
--- code/branches/ScriptableController_FS18/src/orxonox/worldentities/pawns/AAAAutonomousDrone.cc 2018-05-24 14:32:19 UTC (rev 12005)
+++ code/branches/ScriptableController_FS18/src/orxonox/worldentities/pawns/AAAAutonomousDrone.cc 2018-05-24 14:42:43 UTC (rev 12006)
@@ -1,208 +0,0 @@
-/*
- * 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:
- * Oli Scheuss
- * Co-authors:
- * Damian 'Mozork' Frick
- *
- */
-
-#include "AAAAutonomousDrone.h"
-
-#include "core/CoreIncludes.h"
-#include "BulletDynamics/Dynamics/btRigidBody.h"
-
-namespace orxonox
-{
- //TODO: Put your code in here:
- // Create the factory for the drone.
-
- /**
- @brief
- Constructor. Registers the object and initializes some default values.
- @param creator
- The creator of this object.
- */
-
- RegisterClass(AAAAutonomousDrone);
-
- AAAAutonomousDrone::AAAAutonomousDrone(Context* context) : Pawn(context)
- {
- //TODO: Put your code in here:
- // Register the drone class to the core.
-
- RegisterObject(AAAAutonomousDrone);
-
- //this->myController_ = NULL;
-
- this->localLinearAcceleration_.setValue(0, 0, 0);
- this->localAngularAcceleration_.setValue(0, 0, 0);
- this->primaryThrust_ = 100;
- this->auxiliaryThrust_ = 100;
- this->rotationThrust_ = 10;
- this->mass_ = 100;
- this->linearDamping_ = 0.5;
- this->angularDamping_ = 0.3;
-
- this->setRadarVisibility(false);
-
- this->setCollisionType(WorldEntity::CollisionType::Dynamic);
-
- //this->setCollisionType(CollisionType::Dynamic);
-
- //this->myController_ = new AAAAutonomousDroneController(this); // Creates a new controller and passes our this pointer to it as creator.
- }
-
- /**
- @brief
- Destructor. Destroys controller, if present.
- */
- AAAAutonomousDrone::~AAAAutonomousDrone()
- {
- // Deletes the controller if the object was initialized and the pointer to the controller is not NULL.
- if( this->isInitialized()); //)&& this->myController_ != NULL )
- //delete this->myController_;
- }
-
- /**
- @brief
- Method for creating a AAAAutonomousDrone through XML.
- */
- void AAAAutonomousDrone::XMLPort(Element& xmlelement, XMLPort::Mode mode)
- {
- // This calls the XMLPort function of the parent class
- SUPER(AAAAutonomousDrone, XMLPort, xmlelement, mode);
-
- XMLPortParam(AAAAutonomousDrone, "primaryThrust", setPrimaryThrust, getPrimaryThrust, xmlelement, mode);
- //TODO: Put your code in here:
- // Make sure you add the variables auxiliaryThrust_ and rotationThrust_ to XMLPort.
- // Variables can be added by the following command
- // XMLPortParam(Classname, "xml-attribute-name (i.e. variablename)", setFunctionName, getFunctionName, xmlelement, mode);
- // Also make sure that you also create the get- and set-functions in AAAAutonomousDrone.h. As you can see, the get- and set-functions for the variable primaryThrust_ has already been specified there, so you can get your inspiration from there.
- XMLPortParam(AAAAutonomousDrone, "auxiliaryThrust", setAuxiliaryThrust, getAuxiliaryThrust, xmlelement, mode);
- XMLPortParam(AAAAutonomousDrone, "rotationThrust", setRotationThrust, getRotationThrust, xmlelement, mode);
- XMLPortParam(AAAAutonomousDrone, "mass", setMass, getMass, xmlelement, mode);
- XMLPortParam(AAAAutonomousDrone, "linearDamping", setLinearDamping, getLinearDamping, xmlelement, mode);
- XMLPortParam(AAAAutonomousDrone, "angularDamping", setAngularDamping, getAngularDamping, xmlelement, mode);
-
-
-
-
-
- }
-
- /**
- @brief
- Defines which actions the AAAAutonomousDrone has to take in each tick.
- @param dt
- The length of the tick.
- */
- void AAAAutonomousDrone::tick(float dt)
- {
- SUPER(AAAAutonomousDrone, tick, dt);
-
-
- this->localLinearAcceleration_.setX(this->localLinearAcceleration_.x() * getMass() * this->auxiliaryThrust_);
- this->localLinearAcceleration_.setY(this->localLinearAcceleration_.y() * getMass() * this->auxiliaryThrust_);
-
-
- if (this->localLinearAcceleration_.z() > 0)
- this->localLinearAcceleration_.setZ(this->localLinearAcceleration_.z() * getMass() * this->auxiliaryThrust_);
- else
- this->localLinearAcceleration_.setZ(this->localLinearAcceleration_.z() * getMass() * this->primaryThrust_);
-
- this->physicalBody_->applyCentralForce(physicalBody_->getWorldTransform().getBasis() * this->localLinearAcceleration_);
- this->localLinearAcceleration_.setValue(0, 0, 0);
-
- this->localAngularAcceleration_ *= this->getLocalInertia() * this->rotationThrust_;
- this->physicalBody_->applyTorque(physicalBody_->getWorldTransform().getBasis() * this->localAngularAcceleration_);
- this->localAngularAcceleration_.setValue(0, 0, 0);
- }
-
- /**
- @brief
- Moves the AAAAutonomousDrone in the negative z-direction (Front/Back) by an amount specified by the first component of the input 2-dim vector.
- @param value
- The vector determining the amount of the movement.
- */
- void AAAAutonomousDrone::moveFrontBack(const Vector2& value)
- {
- this->localLinearAcceleration_.setZ(this->localLinearAcceleration_.z() - value.x);
- }
-
- /**
- @brief
- Moves the AAAAutonomousDrone in the x-direction (Right/Left) by an amount specified by the first component of the input 2-dim vector.
- @param value
- The vector determining the amount of the movement.
- */
- void AAAAutonomousDrone::moveRightLeft(const Vector2& value)
- {
- this->localLinearAcceleration_.setX(this->localLinearAcceleration_.x() + value.x);
- }
-
- /**
- @brief
- Moves the AAAAutonomousDrone in the y-direction (Up/Down) by an amount specified by the first component of the input 2-dim vector.
- @param value
- The vector determining the amount of the movement.
- */
- void AAAAutonomousDrone::moveUpDown(const Vector2& value)
- {
- this->localLinearAcceleration_.setY(this->localLinearAcceleration_.y() + value.x);
- }
-
- /**
- @brief
- Rotates the AAAAutonomousDrone around the y-axis by the amount specified by the first component of the input 2-dim vector.
- @param value
- The vector determining the amount of the angular movement.
- */
- void AAAAutonomousDrone::rotateYaw(const Vector2& value)
- {
- this->localAngularAcceleration_.setY(this->localAngularAcceleration_.y() - value.x);
- }
-
- /**
- @brief
- Rotates the AAAAutonomousDrone around the x-axis by the amount specified by the first component of the input 2-dim vector.
- @param value
- The vector determining the amount of the angular movement.
- */
- void AAAAutonomousDrone::rotatePitch(const Vector2& value)
- {
- this->localAngularAcceleration_.setX(this->localAngularAcceleration_.x() + value.x);
- }
-
- /**
- @brief
- Rotates the AAAAutonomousDrone around the z-axis by the amount specified by the first component of the input 2-dim vector.
- @param value
- The vector determining the amount of the angular movement.
- */
- void AAAAutonomousDrone::rotateRoll(const Vector2& value)
- {
- this->localAngularAcceleration_.setZ(this->localAngularAcceleration_.z() + value.x);
- }
-
-
-}
Deleted: code/branches/ScriptableController_FS18/src/orxonox/worldentities/pawns/AAAAutonomousDrone.h
===================================================================
--- code/branches/ScriptableController_FS18/src/orxonox/worldentities/pawns/AAAAutonomousDrone.h 2018-05-24 14:32:19 UTC (rev 12005)
+++ code/branches/ScriptableController_FS18/src/orxonox/worldentities/pawns/AAAAutonomousDrone.h 2018-05-24 14:42:43 UTC (rev 12006)
@@ -1,212 +0,0 @@
-/*
- * 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:
- * Oli Scheuss
- * Co-authors:
- * Damian 'Mozork' Frick
- *
- */
-
-#ifndef _AAAAutonomousDrone_H__
-#define _AAAAutonomousDrone_H__
-
-#include "OrxonoxPrereqs.h"
-
-#include "core/XMLPort.h"
-//#include "controllers/AutonomousDroneController.h"
-
-#include "Pawn.h"
-
-namespace orxonox {
-
- /**
- @brief
- Drone, that is made to move upon a specified pattern.
- This class was constructed for the PPS tutorial.
- @author
- Oli Scheuss
- */
- class _OrxonoxExport AAAAutonomousDrone : public Pawn
- {
- public:
- AAAAutonomousDrone(Context* context);
- virtual ~AAAAutonomousDrone();
-
- virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); //!< Method for creating an AutonomousDrone through XML.
- virtual void tick(float dt); //!< Defines which actions the AutonomousDrone has to take in each tick.
-
- virtual void moveFrontBack(const Vector2& value);
- virtual void moveRightLeft(const Vector2& value);
- virtual void moveUpDown(const Vector2& value);
-
- virtual void rotateYaw(const Vector2& value);
- virtual void rotatePitch(const Vector2& value);
- virtual void rotateRoll(const Vector2& value);
-
- /**
- @brief Moves the Drone in the Front/Back-direction by the specifed amount.
- @param value The amount by which the drone is to be moved.
- */
-
-
- inline void moveFrontBack(float value)
- { this->moveFrontBack(Vector2(value, 0)); }
- /**
- @brief Moves the Drone in the Right/Left-direction by the specifed amount.
- @param value The amount by which the drone is to be moved.
- */
- inline void moveRightLeft(float value)
- { this->moveRightLeft(Vector2(value, 0)); }
- /**
- @brief Moves the Drone in the Up/Down-direction by the specifed amount.
- @param value The amount by which the drone is to be moved.
- */
- inline void moveUpDown(float value)
- { this->moveUpDown(Vector2(value, 0)); }
-
- /**
- @brief Rotates the Drone around the y-axis by the specifed amount.
- @param value The amount by which the drone is to be rotated.
- */
- inline void rotateYaw(float value)
- { this->rotateYaw(Vector2(value, 0)); }
- /**
- @brief Rotates the Drone around the x-axis by the specifed amount.
- @param value The amount by which the drone is to be rotated.
- */
- inline void rotatePitch(float value)
- { this->rotatePitch(Vector2(value, 0)); }
- /**
- @brief Rotates the Drone around the z-axis by the specifed amount.
- @param value The amount by which the drone is to be rotated.
- */
- inline void rotateRoll(float value)
- { this->rotateRoll(Vector2(value, 0)); }
-
- /**
- @brief Sets the primary thrust to the input amount.
- @param thrust The amount of thrust.
- */
- inline void setPrimaryThrust( float thrust )
- { this->primaryThrust_ = thrust; }
- //TODO: Place your set-functions here.
- // Hint: auxiliary thrust, rotation thrust.
-
-
- /**
- @brief Sets the auxiliary thrust to the input amount.
- @param thrust The amount of thrust.
- */
- inline void setAuxiliaryThrust( float thrust )
- { this->auxiliaryThrust_ = thrust; }
-
- /**
- @brief Sets the rotation thrust to the input amount.
- @param thrust The amount of thrust.
- */
- inline void setRotationThrust( float thrust )
- { this->rotationThrust_ = thrust; }
-
- /**
- @brief Sets the rotation thrust to the input amount.
- @param thrust The amount of thrust.
- */
- inline void setMass( float mass )
- { this->mass_ = mass; }
-
- /**
- @brief Sets the rotation thrust to the input amount.
- @param thrust The amount of thrust.
- */
- inline void setLinearDamping( float damping )
- { this->linearDamping_ = damping; }
-
- /**
- @brief Sets the rotation thrust to the input amount.
- @param thrust The amount of thrust.
- */
- inline void setAngularDamping( float damping )
- { this->angularDamping_ = damping; }
-
-
-
- /**
- @brief Gets the primary thrust to the input amount.
- @return The amount of thrust.
- */
- inline float getPrimaryThrust()
- { return this->primaryThrust_; }
- //TODO: Place your get-functions here.
-
- /**
- @brief Gets the primary thrust to the input amount.
- @return The amount of thrust.
- */
- inline float getAuxiliaryThrust()
- { return this->auxiliaryThrust_; }
-
- /**
- @brief Gets the primary thrust to the input amount.
- @return The amount of thrust.
- */
- inline float getRotationThrust()
- { return this->rotationThrust_; }
-
- /**
- @brief Gets the primary thrust to the input amount.
- @return The amount of thrust.
- */
- inline float getMass()
- { return this->mass_; }
-
- /**
- @brief Gets the primary thrust to the input amount.
- @return The amount of thrust.
- */
- inline float getLinearDamping()
- { return this->linearDamping_; }
-
- /**
- @brief Gets the primary thrust to the input amount.
- @return The amount of thrust.
- */
- inline float getAngularDamping()
- { return this->angularDamping_; }
-
-
-
- private:
- //AutonomousDroneController *myController_; //!< The controller of the AutonomousDrone.
-
- btVector3 localLinearAcceleration_; //!< The linear acceleration that is used to move the AutonomousDrone the next tick.
- btVector3 localAngularAcceleration_; //!< The linear angular acceleration that is used to move the AutonomousDrone the next tick.
- float primaryThrust_; //!< The amount of primary thrust. This is just used, when moving forward.
- float auxiliaryThrust_; //!< The amount of auxiliary thrust. Used for all other movements (except for rotations).
- float rotationThrust_; //!< The amount of rotation thrust. Used for rotations only.s
- float mass_;
- float linearDamping_;
- float angularDamping_;
- };
-
-}
-
-#endif // _AutonomousDrone_H__
Modified: code/branches/ScriptableController_FS18/src/orxonox/worldentities/pawns/CMakeLists.txt
===================================================================
--- code/branches/ScriptableController_FS18/src/orxonox/worldentities/pawns/CMakeLists.txt 2018-05-24 14:32:19 UTC (rev 12005)
+++ code/branches/ScriptableController_FS18/src/orxonox/worldentities/pawns/CMakeLists.txt 2018-05-24 14:42:43 UTC (rev 12006)
@@ -3,7 +3,7 @@
Spectator.cc
Pawn.cc
SpaceShip.cc
- AAAAutonomousDrone.cc
+ ScriptableControllerDrone.cc
ModularSpaceShip.cc
TeamBaseMatchBase.cc
Destroyer.cc
Copied: code/branches/ScriptableController_FS18/src/orxonox/worldentities/pawns/ScriptableControllerDrone.cc (from rev 11961, code/branches/ScriptableController_FS18/src/orxonox/worldentities/pawns/AAAAutonomousDrone.cc)
===================================================================
--- code/branches/ScriptableController_FS18/src/orxonox/worldentities/pawns/ScriptableControllerDrone.cc (rev 0)
+++ code/branches/ScriptableController_FS18/src/orxonox/worldentities/pawns/ScriptableControllerDrone.cc 2018-05-24 14:42:43 UTC (rev 12006)
@@ -0,0 +1,208 @@
+/*
+ * 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:
+ * Oli Scheuss
+ * Co-authors:
+ * Damian 'Mozork' Frick
+ *
+ */
+
+#include "ScriptableControllerDrone.h"
+
+#include "core/CoreIncludes.h"
+#include "BulletDynamics/Dynamics/btRigidBody.h"
+
+namespace orxonox
+{
+ //TODO: Put your code in here:
+ // Create the factory for the drone.
+
+ /**
+ @brief
+ Constructor. Registers the object and initializes some default values.
+ @param creator
+ The creator of this object.
+ */
+
+ RegisterClass(ScriptableControllerDrone);
+
+ ScriptableControllerDrone::ScriptableControllerDrone(Context* context) : Pawn(context)
+ {
+ //TODO: Put your code in here:
+ // Register the drone class to the core.
+
+ RegisterObject(ScriptableControllerDrone);
+
+ //this->myController_ = NULL;
+
+ this->localLinearAcceleration_.setValue(0, 0, 0);
+ this->localAngularAcceleration_.setValue(0, 0, 0);
+ this->primaryThrust_ = 100;
+ this->auxiliaryThrust_ = 100;
+ this->rotationThrust_ = 10;
+ this->mass_ = 100;
+ this->linearDamping_ = 0.5;
+ this->angularDamping_ = 0.3;
+
+ this->setRadarVisibility(false);
+
+ this->setCollisionType(WorldEntity::CollisionType::Dynamic);
+
+ //this->setCollisionType(CollisionType::Dynamic);
+
+ //this->myController_ = new ScriptableControllerDroneController(this); // Creates a new controller and passes our this pointer to it as creator.
+ }
+
+ /**
+ @brief
+ Destructor. Destroys controller, if present.
+ */
+ ScriptableControllerDrone::~ScriptableControllerDrone()
+ {
+ // Deletes the controller if the object was initialized and the pointer to the controller is not NULL.
+ if( this->isInitialized()); //)&& this->myController_ != NULL )
+ //delete this->myController_;
+ }
+
+ /**
+ @brief
+ Method for creating a ScriptableControllerDrone through XML.
+ */
+ void ScriptableControllerDrone::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+ {
+ // This calls the XMLPort function of the parent class
+ SUPER(ScriptableControllerDrone, XMLPort, xmlelement, mode);
+
+ XMLPortParam(ScriptableControllerDrone, "primaryThrust", setPrimaryThrust, getPrimaryThrust, xmlelement, mode);
+ //TODO: Put your code in here:
+ // Make sure you add the variables auxiliaryThrust_ and rotationThrust_ to XMLPort.
+ // Variables can be added by the following command
+ // XMLPortParam(Classname, "xml-attribute-name (i.e. variablename)", setFunctionName, getFunctionName, xmlelement, mode);
+ // Also make sure that you also create the get- and set-functions in ScriptableControllerDrone.h. As you can see, the get- and set-functions for the variable primaryThrust_ has already been specified there, so you can get your inspiration from there.
+ XMLPortParam(ScriptableControllerDrone, "auxiliaryThrust", setAuxiliaryThrust, getAuxiliaryThrust, xmlelement, mode);
+ XMLPortParam(ScriptableControllerDrone, "rotationThrust", setRotationThrust, getRotationThrust, xmlelement, mode);
+ XMLPortParam(ScriptableControllerDrone, "mass", setMass, getMass, xmlelement, mode);
+ XMLPortParam(ScriptableControllerDrone, "linearDamping", setLinearDamping, getLinearDamping, xmlelement, mode);
+ XMLPortParam(ScriptableControllerDrone, "angularDamping", setAngularDamping, getAngularDamping, xmlelement, mode);
+
+
+
+
+
+ }
+
+ /**
+ @brief
+ Defines which actions the ScriptableControllerDrone has to take in each tick.
+ @param dt
+ The length of the tick.
+ */
+ void ScriptableControllerDrone::tick(float dt)
+ {
+ SUPER(ScriptableControllerDrone, tick, dt);
+
+
+ this->localLinearAcceleration_.setX(this->localLinearAcceleration_.x() * getMass() * this->auxiliaryThrust_);
+ this->localLinearAcceleration_.setY(this->localLinearAcceleration_.y() * getMass() * this->auxiliaryThrust_);
+
+
+ if (this->localLinearAcceleration_.z() > 0)
+ this->localLinearAcceleration_.setZ(this->localLinearAcceleration_.z() * getMass() * this->auxiliaryThrust_);
+ else
+ this->localLinearAcceleration_.setZ(this->localLinearAcceleration_.z() * getMass() * this->primaryThrust_);
+
+ this->physicalBody_->applyCentralForce(physicalBody_->getWorldTransform().getBasis() * this->localLinearAcceleration_);
+ this->localLinearAcceleration_.setValue(0, 0, 0);
+
+ this->localAngularAcceleration_ *= this->getLocalInertia() * this->rotationThrust_;
+ this->physicalBody_->applyTorque(physicalBody_->getWorldTransform().getBasis() * this->localAngularAcceleration_);
+ this->localAngularAcceleration_.setValue(0, 0, 0);
+ }
+
+ /**
+ @brief
+ Moves the ScriptableControllerDrone in the negative z-direction (Front/Back) by an amount specified by the first component of the input 2-dim vector.
+ @param value
+ The vector determining the amount of the movement.
+ */
+ void ScriptableControllerDrone::moveFrontBack(const Vector2& value)
+ {
+ this->localLinearAcceleration_.setZ(this->localLinearAcceleration_.z() - value.x);
+ }
+
+ /**
+ @brief
+ Moves the ScriptableControllerDrone in the x-direction (Right/Left) by an amount specified by the first component of the input 2-dim vector.
+ @param value
+ The vector determining the amount of the movement.
+ */
+ void ScriptableControllerDrone::moveRightLeft(const Vector2& value)
+ {
+ this->localLinearAcceleration_.setX(this->localLinearAcceleration_.x() + value.x);
+ }
+
+ /**
+ @brief
+ Moves the ScriptableControllerDrone in the y-direction (Up/Down) by an amount specified by the first component of the input 2-dim vector.
+ @param value
+ The vector determining the amount of the movement.
+ */
+ void ScriptableControllerDrone::moveUpDown(const Vector2& value)
+ {
+ this->localLinearAcceleration_.setY(this->localLinearAcceleration_.y() + value.x);
+ }
+
+ /**
+ @brief
+ Rotates the ScriptableControllerDrone around the y-axis by the amount specified by the first component of the input 2-dim vector.
+ @param value
+ The vector determining the amount of the angular movement.
+ */
+ void ScriptableControllerDrone::rotateYaw(const Vector2& value)
+ {
+ this->localAngularAcceleration_.setY(this->localAngularAcceleration_.y() - value.x);
+ }
+
+ /**
+ @brief
+ Rotates the ScriptableControllerDrone around the x-axis by the amount specified by the first component of the input 2-dim vector.
+ @param value
+ The vector determining the amount of the angular movement.
+ */
+ void ScriptableControllerDrone::rotatePitch(const Vector2& value)
+ {
+ this->localAngularAcceleration_.setX(this->localAngularAcceleration_.x() + value.x);
+ }
+
+ /**
+ @brief
+ Rotates the ScriptableControllerDrone around the z-axis by the amount specified by the first component of the input 2-dim vector.
+ @param value
+ The vector determining the amount of the angular movement.
+ */
+ void ScriptableControllerDrone::rotateRoll(const Vector2& value)
+ {
+ this->localAngularAcceleration_.setZ(this->localAngularAcceleration_.z() + value.x);
+ }
+
+
+}
Copied: code/branches/ScriptableController_FS18/src/orxonox/worldentities/pawns/ScriptableControllerDrone.h (from rev 11961, code/branches/ScriptableController_FS18/src/orxonox/worldentities/pawns/AAAAutonomousDrone.h)
===================================================================
--- code/branches/ScriptableController_FS18/src/orxonox/worldentities/pawns/ScriptableControllerDrone.h (rev 0)
+++ code/branches/ScriptableController_FS18/src/orxonox/worldentities/pawns/ScriptableControllerDrone.h 2018-05-24 14:42:43 UTC (rev 12006)
@@ -0,0 +1,212 @@
+/*
+ * 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:
+ * Oli Scheuss
+ * Co-authors:
+ * Damian 'Mozork' Frick
+ *
+ */
+
+#ifndef _ScriptableControllerDrone_H__
+#define _ScriptableControllerDrone_H__
+
+#include "OrxonoxPrereqs.h"
+
+#include "core/XMLPort.h"
+//#include "controllers/AutonomousDroneController.h"
+
+#include "Pawn.h"
+
+namespace orxonox {
+
+ /**
+ @brief
+ Drone, that is made to move upon a specified pattern.
+ This class was constructed for the PPS tutorial.
+ @author
+ Oli Scheuss
+ */
+ class _OrxonoxExport ScriptableControllerDrone : public Pawn
+ {
+ public:
+ ScriptableControllerDrone(Context* context);
+ virtual ~ScriptableControllerDrone();
+
+ virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); //!< Method for creating an AutonomousDrone through XML.
+ virtual void tick(float dt); //!< Defines which actions the AutonomousDrone has to take in each tick.
+
+ virtual void moveFrontBack(const Vector2& value);
+ virtual void moveRightLeft(const Vector2& value);
+ virtual void moveUpDown(const Vector2& value);
+
+ virtual void rotateYaw(const Vector2& value);
+ virtual void rotatePitch(const Vector2& value);
+ virtual void rotateRoll(const Vector2& value);
+
+ /**
+ @brief Moves the Drone in the Front/Back-direction by the specifed amount.
+ @param value The amount by which the drone is to be moved.
+ */
+
+
+ inline void moveFrontBack(float value)
+ { this->moveFrontBack(Vector2(value, 0)); }
+ /**
+ @brief Moves the Drone in the Right/Left-direction by the specifed amount.
+ @param value The amount by which the drone is to be moved.
+ */
+ inline void moveRightLeft(float value)
+ { this->moveRightLeft(Vector2(value, 0)); }
+ /**
+ @brief Moves the Drone in the Up/Down-direction by the specifed amount.
+ @param value The amount by which the drone is to be moved.
+ */
+ inline void moveUpDown(float value)
+ { this->moveUpDown(Vector2(value, 0)); }
+
+ /**
+ @brief Rotates the Drone around the y-axis by the specifed amount.
+ @param value The amount by which the drone is to be rotated.
+ */
+ inline void rotateYaw(float value)
+ { this->rotateYaw(Vector2(value, 0)); }
+ /**
+ @brief Rotates the Drone around the x-axis by the specifed amount.
+ @param value The amount by which the drone is to be rotated.
+ */
+ inline void rotatePitch(float value)
+ { this->rotatePitch(Vector2(value, 0)); }
+ /**
+ @brief Rotates the Drone around the z-axis by the specifed amount.
+ @param value The amount by which the drone is to be rotated.
+ */
+ inline void rotateRoll(float value)
+ { this->rotateRoll(Vector2(value, 0)); }
+
+ /**
+ @brief Sets the primary thrust to the input amount.
+ @param thrust The amount of thrust.
+ */
+ inline void setPrimaryThrust( float thrust )
+ { this->primaryThrust_ = thrust; }
+ //TODO: Place your set-functions here.
+ // Hint: auxiliary thrust, rotation thrust.
+
+
+ /**
+ @brief Sets the auxiliary thrust to the input amount.
+ @param thrust The amount of thrust.
+ */
+ inline void setAuxiliaryThrust( float thrust )
+ { this->auxiliaryThrust_ = thrust; }
+
+ /**
+ @brief Sets the rotation thrust to the input amount.
+ @param thrust The amount of thrust.
+ */
+ inline void setRotationThrust( float thrust )
+ { this->rotationThrust_ = thrust; }
+
+ /**
+ @brief Sets the rotation thrust to the input amount.
+ @param thrust The amount of thrust.
+ */
+ inline void setMass( float mass )
+ { this->mass_ = mass; }
+
+ /**
+ @brief Sets the rotation thrust to the input amount.
+ @param thrust The amount of thrust.
+ */
+ inline void setLinearDamping( float damping )
+ { this->linearDamping_ = damping; }
+
+ /**
+ @brief Sets the rotation thrust to the input amount.
+ @param thrust The amount of thrust.
+ */
+ inline void setAngularDamping( float damping )
+ { this->angularDamping_ = damping; }
+
+
+
+ /**
+ @brief Gets the primary thrust to the input amount.
+ @return The amount of thrust.
+ */
+ inline float getPrimaryThrust()
+ { return this->primaryThrust_; }
+ //TODO: Place your get-functions here.
+
+ /**
+ @brief Gets the primary thrust to the input amount.
+ @return The amount of thrust.
+ */
+ inline float getAuxiliaryThrust()
+ { return this->auxiliaryThrust_; }
+
+ /**
+ @brief Gets the primary thrust to the input amount.
+ @return The amount of thrust.
+ */
+ inline float getRotationThrust()
+ { return this->rotationThrust_; }
+
+ /**
+ @brief Gets the primary thrust to the input amount.
+ @return The amount of thrust.
+ */
+ inline float getMass()
+ { return this->mass_; }
+
+ /**
+ @brief Gets the primary thrust to the input amount.
+ @return The amount of thrust.
+ */
+ inline float getLinearDamping()
+ { return this->linearDamping_; }
+
+ /**
+ @brief Gets the primary thrust to the input amount.
+ @return The amount of thrust.
+ */
+ inline float getAngularDamping()
+ { return this->angularDamping_; }
+
+
+
+ private:
+ //AutonomousDroneController *myController_; //!< The controller of the AutonomousDrone.
+
+ btVector3 localLinearAcceleration_; //!< The linear acceleration that is used to move the AutonomousDrone the next tick.
+ btVector3 localAngularAcceleration_; //!< The linear angular acceleration that is used to move the AutonomousDrone the next tick.
+ float primaryThrust_; //!< The amount of primary thrust. This is just used, when moving forward.
+ float auxiliaryThrust_; //!< The amount of auxiliary thrust. Used for all other movements (except for rotations).
+ float rotationThrust_; //!< The amount of rotation thrust. Used for rotations only.s
+ float mass_;
+ float linearDamping_;
+ float angularDamping_;
+ };
+
+}
+
+#endif // _AutonomousDrone_H__
More information about the Orxonox-commit
mailing list