diff --git a/ag.cc b/ag.cc index b3c9a59..86106ae 100644 --- a/ag.cc +++ b/ag.cc @@ -223,9 +223,7 @@ namespace ag { Engine::Object * obj = getObject(L, -1); if (obj != NULL) - { obj->draw(); - } } return 0; } @@ -236,13 +234,17 @@ namespace ag if (argc == 4) { - double position[3]; - for (int i = 0; i < 3; i++) + Engine::Object * obj = getObject(L, 1); + if (obj != NULL) { - int type = lua_type(L, i); - if (type == LUA_TNUMBER || type == LUA_TSTRING) + double position[3]; + for (int i = 0; i < 3; i++) { - position[i] = lua_tonumber(L, i + 2); + int type = lua_type(L, i); + if (type == LUA_TNUMBER || type == LUA_TSTRING) + { + position[i] = lua_tonumber(L, i + 2); + } } } } @@ -252,6 +254,14 @@ namespace ag int getPosition(lua_State * L) { + int argc = lua_gettop(L); + if (argc == 1) + { + Engine::Object * obj = getObject(L, 1); + if (obj != NULL) + { + } + } return 3; } } diff --git a/anaglym.cc b/anaglym.cc index 257c6ab..04546b1 100644 --- a/anaglym.cc +++ b/anaglym.cc @@ -237,5 +237,5 @@ void Engine::run() void Engine::Object::loadPhy(const std::string & path, bool static_data) { - m_geoms = g_engine->m_world.loadPhy(path, static_data); + geoms = g_engine->m_world.loadPhy(path, &body, static_data); } diff --git a/anaglym.h b/anaglym.h index 16427e2..2c77364 100644 --- a/anaglym.h +++ b/anaglym.h @@ -17,9 +17,11 @@ class Engine class Object { public: + Object() { body = 0; } WFObj * wfobj; GLuint display_list; - std::vector m_geoms; + std::vector geoms; + dBodyID body; void draw() { glCallList(display_list); } void loadPhy(const std::string & path,