Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
May 7, 2014, 2:03:18 PM (10 years ago)
Author:
smerkli
Message:

Fixed some more things. What works now:

  • Setting an ID for the scriptcontroller to be used from C++ in lua
  • Running a script from the controllerdirector triggered by an event
  • Getting an instance of a ScriptController object pointer from lua, and also calling a function of this object with parameters.

Next steps will be implementing different IDs per controller
object and actually swapping out controllers.

File:
1 edited

Legend:

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

    r10045 r10046  
    6767    ScriptController* ScriptController::getScriptController()
    6868    {
     69      /* Output a message that confirms this function was called */
    6970      orxout() << "Great success!" << std::endl;
     71
     72      /* Loop over all the scriptcontrollers currently present in the game */
    7073      for(ObjectList<ScriptController>::iterator it =
    7174        ObjectList<ScriptController>::begin();
     
    8386    void ScriptController::moveToPosition_beta(float x, float y, float z )
    8487    {
     88        /* The section commented out here below throws segfaults */
     89        //const Vector3 local=getPosition();
     90        //const Vector3 target=Vector3(x,y,z);
     91        //Vector3 way=target-local;
     92       
     93       
     94        //this->controlled->lookAt(target);
     95        //this->controlled->moveFrontBack(way.length());     
    8596
    86        const Vector3 local=getPosition();
    87        const Vector3 target=Vector3(x,y,z);
    88 
    89        Vector3 way=target-local;
    90 
    91        
    92        this->controlled->lookAt(target);
    93 
    94         this->controlled->moveFrontBack(way.length());     
    95 
    96 
    97         /*orxout()<<x<<"  "<<y<<"  "<<z<<endl;*/
    98 
    99 
    100 
    101          
     97 
     98        /* This works fine */
     99        orxout()<<x<<"  "<<y<<"  "<<z<<endl;
    102100    }
    103101
Note: See TracChangeset for help on using the changeset viewer.