Changeset 11902
- Timestamp:
- Apr 24, 2018, 5:56:18 PM (7 years ago)
- Location:
- code/branches/ScriptableController_FS18/src/orxonox/scriptablecontroller
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/ScriptableController_FS18/src/orxonox/scriptablecontroller/scriptable_controller_api.cc
r11901 r11902 40 40 41 41 LuaTB<ScriptableControllerAPI, decltype(&ScriptableControllerAPI::myTestFunction)>::registerFunction<&ScriptableControllerAPI::myTestFunction>(this, lua, "mytestfunction"); 42 LuaTB<ScriptableControllerAPI, decltype(&ScriptableControllerAPI::moveControllableEntity)>::registerFunction<&ScriptableControllerAPI::moveControllableEntity>(this, lua, "moveControllableEntity"); 42 43 43 44 … … 362 363 } 363 364 364 //void ScriptableControllerAPI::moveEntity(std::string id, double x, double y, double z) 365 365 void ScriptableControllerAPI::moveControllableEntity(std::string id, double x, double y, double z) 366 { 367 MobileEntity *entity = this->controller_->getMobileEntityByID(id); 368 if(entity == nullptr) 369 { 370 orxout(user_warning) << "Trying to set velocity of an unknown object" << std::endl; 371 return; 372 } 373 374 375 376 377 Identifier *identifier = ClassByString("ControllableEntity"); 378 379 ControllableEntity *controllable_entity; 380 381 if(identifier->isA(ClassIdentifier<ControllableEntity>::getIdentifier())) 382 { 383 controllable_entity = orxonox_cast<ControllableEntity*>(entity); 384 385 controllable_entity->moveFrontBack(x); 386 controllable_entity->moveRightLeft(y); 387 controllable_entity->moveUpDown(z); 388 } 389 390 return; 391 392 } 366 393 } -
code/branches/ScriptableController_FS18/src/orxonox/scriptablecontroller/scriptable_controller_api.h
r11854 r11902 206 206 double myTestFunction(double x, double y); 207 207 208 void moveControllableEntity(std::string id, double x, double y, double z); 209 208 210 // ### API END ################################################################ 209 211
Note: See TracChangeset
for help on using the changeset viewer.