diff --git a/Engine.cc b/Engine.cc index 806edfe..0aa2eea 100644 --- a/Engine.cc +++ b/Engine.cc @@ -297,6 +297,18 @@ int Engine::addObject(bool is_static, OdeWorld::GeomType geom_type, return id; } +int Engine::addAMotor(Object * o1, Object * o2) +{ + dBodyID b1 = 0; + dBodyID b2 = 0; + if (o1 != NULL) + b1 = o1->getBody(); + if (o2 != NULL) + b2 = o2->getBody(); + dJointID j = dJointCreateAMotor(m_world.getWorldID(), 0); + /* TODO: finish */ +} + void Engine::removeObject(int id) { Object * obj = getObject(id); diff --git a/Engine.h b/Engine.h index 349075f..d7c329b 100644 --- a/Engine.h +++ b/Engine.h @@ -77,6 +77,7 @@ class Engine dReal getMass() { return m_ode_object->getMass(); } void setMass(dReal mass) { m_ode_object->setMass(mass); } const float * getAABB() { return m_aabb; } + dBodyID getBody() { return m_ode_object->getBody(); } protected: void createManagedObject(); @@ -123,6 +124,7 @@ class Engine int addObject(WFObj * obj, bool is_static, float scale = 1.0f); int addObject(bool is_static, OdeWorld::GeomType geom_type, refptr< std::vector > args); + int addAMotor(Object * o1, Object * o2); void removeObject(int id); int cloneObject(const Object * obj); Object * getObject(int id); @@ -209,6 +211,7 @@ class Engine std::string m_engine_path; OdeWorld m_world; std::map m_objects; + std::map m_joints; int m_next_object_index; int m_next_text_index; GLdouble m_eye[3]; diff --git a/ag.cc b/ag.cc index 24fc466..56ee029 100644 --- a/ag.cc +++ b/ag.cc @@ -98,6 +98,19 @@ namespace ag "end\n" "ag.createAMotor = function(obj1, obj2, axis1, axis2, axis3)\n" + " local o1 = obj1\n" + " local o2 = obj2\n" + " local num_axes = 1\n" + " if (type(obj1) == \"number\") then\n" + " if (obj1 == 0) then\n" + " o1 = { id = 0 }\n" + " end\n" + " end\n" + " if (type(obj2) == \"number\") then\n" + " if (obj2 == 0) then\n" + " o2 = { id = 0 }\n" + " end\n" + " end\n" "end\n" ); lua_pcall(L, 0, 0, 0);