Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Apr 10, 2014, 3:40:57 PM (10 years ago)
Author:
samuezu
Message:

compiles now

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/ScriptableController/src/orxonox/controllers/ScriptController.cc

    r10025 r10028  
    2929#include "ScriptController.h"
    3030#include "core/CoreIncludes.h"
     31#include "worldentities/ControllableEntity.h"
    3132
    3233namespace orxonox
     
    3435    RegisterClass(ScriptController);
    3536
    36     ScriptController::ScriptController(Context* context, ControllableEntity CE) : ArtificialController(context)
     37    //ScriptController::ScriptController(Context* context, ControllableEntity* CE) : ArtificialController(context)
     38    ScriptController::ScriptController(Context* context) : ArtificialController(context)
    3739    {
    3840        RegisterObject(ScriptController);
    39         set_controlled(CE);
     41        //set_controlled(CE);
    4042    }
    4143
    42     void set_luasrc(std::string lsrc)
     44    void ScriptController::set_luasrc(std::string lsrc)
    4345    {
    4446        this->luasrc=lsrc;
    4547    }
    4648
    47     void set_controlled(*ControllableEntity toControl)
     49    void ScriptController::set_controlled(ControllableEntity* toControl)
    4850    {
    4951        this->controlled=toControl;
     
    5254    void ScriptController::XMLPort(Element& xmlelement, XMLPort::Mode mode)
    5355    {
    54         XMLPort(ScriptController, BaseObject, "lsrc", set_luasrc, xmlelement, mode);
     56        //XMLPortParam(ScriptController, BaseObject, "lsrc", set_luasrc, xmlelement, mode);
    5557
    5658    }
     
    5860    void ScriptController::moveToPosition(const Vector3& target)
    5961    {
     62       
     63        /*this->controlled_->rotateYaw(-sgn(coord.x)*coord.x*coord.x);
     64        this->controlled_->rotatePitch(sgn(coord.y)*coord.y*coord.y);*/
     65    }
    6066
     67    /*void WaypointController::tick(float dt)  //copied from waypointcontroller
     68    {
     69        if (!this->isActive())
     70            return;
    6171
    62     }
     72        if (this->waypoints_.size() == 0 || !this->getControllableEntity())
     73            return;
     74
     75        if (this->waypoints_[this->currentWaypoint_]->getWorldPosition().squaredDistance(this->getControllableEntity()->getPosition()) <= this->squaredaccuracy_)
     76            this->currentWaypoint_ = (this->currentWaypoint_ + 1) % this->waypoints_.size();
     77
     78        this->moveToPosition(this->waypoints_[this->currentWaypoint_]->getWorldPosition());
     79    }*/
     80
    6381    /* TO DO
    6482                in the constuctor: make accessible functions such as moveToPosition.. in LUA
    6583            ->tolua++ example: http://usefulgamedev.weebly.com/tolua-example.html*/
     84
     85
    6686
    6787    //function to execute the luafile
Note: See TracChangeset for help on using the changeset viewer.