Changeset 12006 for code/branches/ScriptableController_FS18
- Timestamp:
- May 24, 2018, 4:42:43 PM (7 years ago)
- Location:
- code/branches/ScriptableController_FS18
- Files:
-
- 3 edited
- 7 moved
Legend:
- Unmodified
- Added
- Removed
-
code/branches/ScriptableController_FS18/data/levels/ScriptableControllerTestMoveKillDrone.oxw
r11999 r12006 1 1 <LevelInfo 2 name = "Scriptable Controller Spawning Pawn"3 description = "Demonstrates spawning a drone by using a lua script."2 name = "Scriptable Controller Moving and Killing Pawn" 3 description = "Demonstrates moving and killing a drone by using a lua script." 4 4 tags = "test" 5 5 screenshot = "emptylevel.png" … … 18 18 ?> 19 19 20 <Level script="scripts/ BBBScriptableControllerTest.lua">20 <Level script="scripts/ScriptableControllerMoveKill.lua"> 21 21 <templates> 22 22 <Template link=lodtemplate_default /> … … 33 33 34 34 35 < AAAAutonomousDrone id="dummy" position="0,0,0">35 <ScriptableControllerDrone id="dummy" position="0,0,0"> 36 36 <attached> 37 37 <Model scale="10" mesh="drone.mesh"/> … … 40 40 <BoxCollisionShape position="0,0,0" halfExtents="10, 10, 10" /> 41 41 </collisionShapes> 42 </ AAAAutonomousDrone>42 </ScriptableControllerDrone> 43 43 44 44 -
code/branches/ScriptableController_FS18/data/levels/ScriptableControllerTestSpawn.oxw
r11999 r12006 1 1 <LevelInfo 2 name = "Scriptable Controller Moving and Killing Pawn"3 description = "Demonstrates moving and killing a drone by using a lua script."2 name = "Scriptable Controller Spawning Pawn" 3 description = "Demonstrates spawning a drone by using a lua script." 4 4 tags = "test" 5 5 screenshot = "emptylevel.png" … … 16 16 include("templates/spaceshipEscort.oxt") 17 17 include("templates/endurancetest_template.oxt") 18 include("templates/ AAAAutonomousDroneTemplate.oxt")18 include("templates/ScriptableControllerDroneTemplate.oxt") 19 19 ?> 20 20 21 <Level script="scripts/ AAAScriptableControllerTest.lua">21 <Level script="scripts/ScriptableControllerSpawn.lua"> 22 22 <templates> 23 23 <Template link=lodtemplate_default /> … … 32 32 <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"/> 33 33 <SpawnPoint team=0 position="100,0,0" lookat="0,0,0" spawnclass=SpaceShip pawndesign=spaceshipescort /> 34 <!-- <SpawnPoint team=2 position="0,0,0" lookat="0,0,0" spawnclass=AAAAutonomousDrone pawndesign=AAAAutonomousDroneTemplate /> -->35 34 36 35 -
code/branches/ScriptableController_FS18/data/levels/templates/ScriptableControllerDroneTemplate.oxt
r11999 r12006 1 <Template name= AAAAutonomousDroneTemplate>2 < AAAAutonomousDrone>1 <Template name=ScriptableControllerDroneTemplate> 2 <ScriptableControllerDrone> 3 3 <attached> 4 4 <Model scale="10" mesh="drone.mesh"/> … … 7 7 <BoxCollisionShape position="0,0,0" halfExtents="10, 10, 10" /> 8 8 </collisionShapes> 9 </ AAAAutonomousDrone>9 </ScriptableControllerDrone> 10 10 </Template> -
code/branches/ScriptableController_FS18/src/orxonox/Level.cc
r11974 r12006 58 58 this->xmlfile_ = nullptr; 59 59 this->controller_.reset(new ScriptableController()); 60 this->controller_->level_ = this;61 60 } 62 61 -
code/branches/ScriptableController_FS18/src/orxonox/scriptablecontroller/scriptable_controller_api.cc
r11999 r12006 9 9 //#include "../modules/objects/collisionshapes/SphereCollisionShape.h" 10 10 #include "graphics/Model.h" 11 #include "worldentities/pawns/ AAAAutonomousDrone.h"11 #include "worldentities/pawns/ScriptableControllerDrone.h" 12 12 13 13 … … 210 210 211 211 212 Identifier *identifier = ClassByString(" AAAAutonomousDrone");212 Identifier *identifier = ClassByString("ScriptableControllerDrone"); 213 213 214 214 … … 277 277 Pawn* pawn = this->controller_->getPawnByID(id); 278 278 //Attach to pawn 279 AAAAutonomousDrone* drone = new AAAAutonomousDrone(pawn->getContext()); // this is neccessary because the projectiles fired need a valid creator for the particlespawner (when colliding against something)280 281 drone->addTemplate(" AAAAutonomousDroneTemplate"); //AAAAutonomousDroneTemplate spaceshipescort279 ScriptableControllerDrone* drone = new ScriptableControllerDrone(pawn->getContext()); // this is neccessary because the projectiles fired need a valid creator for the particlespawner (when colliding against something) 280 281 drone->addTemplate("ScriptableControllerDroneTemplate"); //ScriptableControllerDroneTemplate spaceshipescort 282 282 283 283 Vector3 spawnPosition = pawn->getWorldPosition() + Vector3(30,0,-30); -
code/branches/ScriptableController_FS18/src/orxonox/worldentities/pawns/CMakeLists.txt
r11906 r12006 4 4 Pawn.cc 5 5 SpaceShip.cc 6 AAAAutonomousDrone.cc6 ScriptableControllerDrone.cc 7 7 ModularSpaceShip.cc 8 8 TeamBaseMatchBase.cc -
code/branches/ScriptableController_FS18/src/orxonox/worldentities/pawns/ScriptableControllerDrone.cc
r11961 r12006 27 27 */ 28 28 29 #include " AAAAutonomousDrone.h"29 #include "ScriptableControllerDrone.h" 30 30 31 31 #include "core/CoreIncludes.h" … … 44 44 */ 45 45 46 RegisterClass( AAAAutonomousDrone);46 RegisterClass(ScriptableControllerDrone); 47 47 48 AAAAutonomousDrone::AAAAutonomousDrone(Context* context) : Pawn(context)48 ScriptableControllerDrone::ScriptableControllerDrone(Context* context) : Pawn(context) 49 49 { 50 50 //TODO: Put your code in here: 51 51 // Register the drone class to the core. 52 52 53 RegisterObject( AAAAutonomousDrone);53 RegisterObject(ScriptableControllerDrone); 54 54 55 55 //this->myController_ = NULL; … … 70 70 //this->setCollisionType(CollisionType::Dynamic); 71 71 72 //this->myController_ = new AAAAutonomousDroneController(this); // Creates a new controller and passes our this pointer to it as creator.72 //this->myController_ = new ScriptableControllerDroneController(this); // Creates a new controller and passes our this pointer to it as creator. 73 73 } 74 74 … … 77 77 Destructor. Destroys controller, if present. 78 78 */ 79 AAAAutonomousDrone::~AAAAutonomousDrone()79 ScriptableControllerDrone::~ScriptableControllerDrone() 80 80 { 81 81 // Deletes the controller if the object was initialized and the pointer to the controller is not NULL. … … 86 86 /** 87 87 @brief 88 Method for creating a AAAAutonomousDrone through XML.89 */ 90 void AAAAutonomousDrone::XMLPort(Element& xmlelement, XMLPort::Mode mode)88 Method for creating a ScriptableControllerDrone through XML. 89 */ 90 void ScriptableControllerDrone::XMLPort(Element& xmlelement, XMLPort::Mode mode) 91 91 { 92 92 // This calls the XMLPort function of the parent class 93 SUPER( AAAAutonomousDrone, XMLPort, xmlelement, mode);94 95 XMLPortParam( AAAAutonomousDrone, "primaryThrust", setPrimaryThrust, getPrimaryThrust, xmlelement, mode);93 SUPER(ScriptableControllerDrone, XMLPort, xmlelement, mode); 94 95 XMLPortParam(ScriptableControllerDrone, "primaryThrust", setPrimaryThrust, getPrimaryThrust, xmlelement, mode); 96 96 //TODO: Put your code in here: 97 97 // Make sure you add the variables auxiliaryThrust_ and rotationThrust_ to XMLPort. 98 98 // Variables can be added by the following command 99 99 // XMLPortParam(Classname, "xml-attribute-name (i.e. variablename)", setFunctionName, getFunctionName, xmlelement, mode); 100 // 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.101 XMLPortParam( AAAAutonomousDrone, "auxiliaryThrust", setAuxiliaryThrust, getAuxiliaryThrust, xmlelement, mode);102 XMLPortParam( AAAAutonomousDrone, "rotationThrust", setRotationThrust, getRotationThrust, xmlelement, mode);103 XMLPortParam( AAAAutonomousDrone, "mass", setMass, getMass, xmlelement, mode);104 XMLPortParam( AAAAutonomousDrone, "linearDamping", setLinearDamping, getLinearDamping, xmlelement, mode);105 XMLPortParam( AAAAutonomousDrone, "angularDamping", setAngularDamping, getAngularDamping, xmlelement, mode);100 // 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. 101 XMLPortParam(ScriptableControllerDrone, "auxiliaryThrust", setAuxiliaryThrust, getAuxiliaryThrust, xmlelement, mode); 102 XMLPortParam(ScriptableControllerDrone, "rotationThrust", setRotationThrust, getRotationThrust, xmlelement, mode); 103 XMLPortParam(ScriptableControllerDrone, "mass", setMass, getMass, xmlelement, mode); 104 XMLPortParam(ScriptableControllerDrone, "linearDamping", setLinearDamping, getLinearDamping, xmlelement, mode); 105 XMLPortParam(ScriptableControllerDrone, "angularDamping", setAngularDamping, getAngularDamping, xmlelement, mode); 106 106 107 107 … … 113 113 /** 114 114 @brief 115 Defines which actions the AAAAutonomousDrone has to take in each tick.115 Defines which actions the ScriptableControllerDrone has to take in each tick. 116 116 @param dt 117 117 The length of the tick. 118 118 */ 119 void AAAAutonomousDrone::tick(float dt)120 { 121 SUPER( AAAAutonomousDrone, tick, dt);119 void ScriptableControllerDrone::tick(float dt) 120 { 121 SUPER(ScriptableControllerDrone, tick, dt); 122 122 123 123 … … 141 141 /** 142 142 @brief 143 Moves the AAAAutonomousDrone in the negative z-direction (Front/Back) by an amount specified by the first component of the input 2-dim vector.143 Moves the ScriptableControllerDrone in the negative z-direction (Front/Back) by an amount specified by the first component of the input 2-dim vector. 144 144 @param value 145 145 The vector determining the amount of the movement. 146 146 */ 147 void AAAAutonomousDrone::moveFrontBack(const Vector2& value)147 void ScriptableControllerDrone::moveFrontBack(const Vector2& value) 148 148 { 149 149 this->localLinearAcceleration_.setZ(this->localLinearAcceleration_.z() - value.x); … … 152 152 /** 153 153 @brief 154 Moves the AAAAutonomousDrone in the x-direction (Right/Left) by an amount specified by the first component of the input 2-dim vector.154 Moves the ScriptableControllerDrone in the x-direction (Right/Left) by an amount specified by the first component of the input 2-dim vector. 155 155 @param value 156 156 The vector determining the amount of the movement. 157 157 */ 158 void AAAAutonomousDrone::moveRightLeft(const Vector2& value)158 void ScriptableControllerDrone::moveRightLeft(const Vector2& value) 159 159 { 160 160 this->localLinearAcceleration_.setX(this->localLinearAcceleration_.x() + value.x); … … 163 163 /** 164 164 @brief 165 Moves the AAAAutonomousDrone in the y-direction (Up/Down) by an amount specified by the first component of the input 2-dim vector.165 Moves the ScriptableControllerDrone in the y-direction (Up/Down) by an amount specified by the first component of the input 2-dim vector. 166 166 @param value 167 167 The vector determining the amount of the movement. 168 168 */ 169 void AAAAutonomousDrone::moveUpDown(const Vector2& value)169 void ScriptableControllerDrone::moveUpDown(const Vector2& value) 170 170 { 171 171 this->localLinearAcceleration_.setY(this->localLinearAcceleration_.y() + value.x); … … 174 174 /** 175 175 @brief 176 Rotates the AAAAutonomousDrone around the y-axis by the amount specified by the first component of the input 2-dim vector.176 Rotates the ScriptableControllerDrone around the y-axis by the amount specified by the first component of the input 2-dim vector. 177 177 @param value 178 178 The vector determining the amount of the angular movement. 179 179 */ 180 void AAAAutonomousDrone::rotateYaw(const Vector2& value)180 void ScriptableControllerDrone::rotateYaw(const Vector2& value) 181 181 { 182 182 this->localAngularAcceleration_.setY(this->localAngularAcceleration_.y() - value.x); … … 185 185 /** 186 186 @brief 187 Rotates the AAAAutonomousDrone around the x-axis by the amount specified by the first component of the input 2-dim vector.187 Rotates the ScriptableControllerDrone around the x-axis by the amount specified by the first component of the input 2-dim vector. 188 188 @param value 189 189 The vector determining the amount of the angular movement. 190 190 */ 191 void AAAAutonomousDrone::rotatePitch(const Vector2& value)191 void ScriptableControllerDrone::rotatePitch(const Vector2& value) 192 192 { 193 193 this->localAngularAcceleration_.setX(this->localAngularAcceleration_.x() + value.x); … … 196 196 /** 197 197 @brief 198 Rotates the AAAAutonomousDrone around the z-axis by the amount specified by the first component of the input 2-dim vector.198 Rotates the ScriptableControllerDrone around the z-axis by the amount specified by the first component of the input 2-dim vector. 199 199 @param value 200 200 The vector determining the amount of the angular movement. 201 201 */ 202 void AAAAutonomousDrone::rotateRoll(const Vector2& value)202 void ScriptableControllerDrone::rotateRoll(const Vector2& value) 203 203 { 204 204 this->localAngularAcceleration_.setZ(this->localAngularAcceleration_.z() + value.x); -
code/branches/ScriptableController_FS18/src/orxonox/worldentities/pawns/ScriptableControllerDrone.h
r11961 r12006 27 27 */ 28 28 29 #ifndef _ AAAAutonomousDrone_H__30 #define _ AAAAutonomousDrone_H__29 #ifndef _ScriptableControllerDrone_H__ 30 #define _ScriptableControllerDrone_H__ 31 31 32 32 #include "OrxonoxPrereqs.h" … … 46 46 Oli Scheuss 47 47 */ 48 class _OrxonoxExport AAAAutonomousDrone : public Pawn48 class _OrxonoxExport ScriptableControllerDrone : public Pawn 49 49 { 50 50 public: 51 AAAAutonomousDrone(Context* context);52 virtual ~ AAAAutonomousDrone();51 ScriptableControllerDrone(Context* context); 52 virtual ~ScriptableControllerDrone(); 53 53 54 54 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); //!< Method for creating an AutonomousDrone through XML.
Note: See TracChangeset
for help on using the changeset viewer.