Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 11999


Ignore:
Timestamp:
May 24, 2018, 3:59:22 PM (6 years ago)
Author:
adamc
Message:

Spawning pawn works now, BUT still incompatible with moving spawned pawn

Location:
code/branches/ScriptableController_FS18
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • code/branches/ScriptableController_FS18/data/levels/AAAScriptableControllerTest.oxw

    r11974 r11999  
    11<LevelInfo
    2  name = "AAAScriptableControllerTest"
    3  description = "Demonstrates moving and killing a drone by use of a script."
     2 name = "Scriptable Controller Moving and Killing Pawn"
     3 description = "Demonstrates moving and killing a drone by using a lua script."
    44 tags = "test"
    55 screenshot = "emptylevel.png"
  • code/branches/ScriptableController_FS18/data/levels/BBBScriptableControllerTest.oxw

    r11932 r11999  
    11<LevelInfo
    2  name = "BBBScriptableControllerTest"
    3  description = "Demonstrates moving and killing a drone by use of a script."
     2 name = "Scriptable Controller Spawning Pawn"
     3 description = "Demonstrates spawning a drone by using a lua script."
    44 tags = "test"
    55 screenshot = "emptylevel.png"
  • code/branches/ScriptableController_FS18/data/levels/scripts/AAAScriptableControllerTest.lua

    r11974 r11999  
    6363        orxPrint("Spawning dummy!")
    6464        spawnTest("dummy")
     65        move_dummy()
    6566end
    6667
     
    107108
    108109
     110
  • code/branches/ScriptableController_FS18/data/levels/templates/AAAAutonomousDroneTemplate.oxt

    r11974 r11999  
    22  <AAAAutonomousDrone>
    33    <attached>
    4       <Model scale="10" position="0,0,0" mesh="drone.mesh"/>
     4      <Model scale="10" mesh="drone.mesh"/>
    55    </attached>
    66    <collisionShapes>
  • code/branches/ScriptableController_FS18/src/libraries/core/BaseObject.cc

    r11103 r11999  
    7777        {
    7878            this->setFile(this->creator_->getFile());
    79 
     79           
    8080            // store strong-pointers on all four base objects by default (can be overwritten with weak-ptr after the constructor if necessary)
    8181            this->setNamespace(this->creator_->namespace_.createStrongPtr());
  • code/branches/ScriptableController_FS18/src/orxonox/Level.h

    r11974 r11999  
    6464
    6565            void addObject(BaseObject* object);
     66            BaseObject* getObject(unsigned int index) const;
    6667
    6768        private:
    6869            void registerVariables();
    6970            //void addObject(BaseObject* object);
    70             BaseObject* getObject(unsigned int index) const;
     71            //BaseObject* getObject(unsigned int index) const;
    7172
    7273            void addLodInfo(MeshLodInformation* object);
  • code/branches/ScriptableController_FS18/src/orxonox/scriptablecontroller/scriptable_controller_api.cc

    r11974 r11999  
    77#include "infos/Bot.h"
    88#include "worldentities/pawns/ModularSpaceShip.h"
     9//#include "../modules/objects/collisionshapes/SphereCollisionShape.h"
     10#include "graphics/Model.h"
     11#include "worldentities/pawns/AAAAutonomousDrone.h"
     12
    913
    1014namespace orxonox
     
    268272        }
    269273
    270         //for (Level* level : ObjectList<Level>())
    271         //    level->loadedNewXMLName(this);
    272 
    273 
    274 
    275 
    276 
    277         /////!!!!!!!!!!!!!!!
    278 
    279         this->controller_->level_->addObject(orxonox_cast<Pawn*>(entity));
    280 
    281 
     274
     275
     276        ///////////////GOLD!!!!!!!!!!!!!!!////////////////////////
     277        Pawn* pawn = this->controller_->getPawnByID(id);
     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 spaceshipescort
     282
     283        Vector3 spawnPosition = pawn->getWorldPosition() + Vector3(30,0,-30);
     284        drone->setPosition(spawnPosition);
     285        //drone->moveFrontBack(1.0);
    282286
    283287
     
    494498    {
    495499        MobileEntity *entity = this->controller_->getMobileEntityByID(id);
     500       
    496501        if(entity == nullptr)
    497502        {
     
    499504            return;
    500505        }
    501 
    502506
    503507        Identifier *identifier = ClassByString("ControllableEntity");
     
    505509        ControllableEntity *controllable_entity;
    506510       
    507 
    508511        if(identifier->isA(ClassIdentifier<ControllableEntity>::getIdentifier()))
    509512        {
     513            orxout(user_info) << "Before final cast..."<< endl;
    510514            controllable_entity = orxonox_cast<ControllableEntity*>(entity);
     515            orxout(user_info) << "After final cast..."<< endl;
    511516            //ATTACHED COLLISION SHAPE is MANDATORY in order to move the entity
    512517            controllable_entity->moveFrontBack(x);
    513518            controllable_entity->moveRightLeft(y);
    514519            controllable_entity->moveUpDown(z);
     520            orxout(user_info) << "After move..."<< endl;
    515521        }
    516522
Note: See TracChangeset for help on using the changeset viewer.