Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

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

Location:
code/branches/ScriptableController_FS18/src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • 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.