working on addAMotor()
git-svn-id: svn://anubis/anaglym/trunk@229 99a6e188-d820-4881-8870-2d33a10e2619
This commit is contained in:
parent
ffe587c0a3
commit
044e088b2a
12
Engine.cc
12
Engine.cc
@ -297,6 +297,18 @@ int Engine::addObject(bool is_static, OdeWorld::GeomType geom_type,
|
|||||||
return id;
|
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)
|
void Engine::removeObject(int id)
|
||||||
{
|
{
|
||||||
Object * obj = getObject(id);
|
Object * obj = getObject(id);
|
||||||
|
3
Engine.h
3
Engine.h
@ -77,6 +77,7 @@ class Engine
|
|||||||
dReal getMass() { return m_ode_object->getMass(); }
|
dReal getMass() { return m_ode_object->getMass(); }
|
||||||
void setMass(dReal mass) { m_ode_object->setMass(mass); }
|
void setMass(dReal mass) { m_ode_object->setMass(mass); }
|
||||||
const float * getAABB() { return m_aabb; }
|
const float * getAABB() { return m_aabb; }
|
||||||
|
dBodyID getBody() { return m_ode_object->getBody(); }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void createManagedObject();
|
void createManagedObject();
|
||||||
@ -123,6 +124,7 @@ class Engine
|
|||||||
int addObject(WFObj * obj, bool is_static, float scale = 1.0f);
|
int addObject(WFObj * obj, bool is_static, float scale = 1.0f);
|
||||||
int addObject(bool is_static, OdeWorld::GeomType geom_type,
|
int addObject(bool is_static, OdeWorld::GeomType geom_type,
|
||||||
refptr< std::vector<float> > args);
|
refptr< std::vector<float> > args);
|
||||||
|
int addAMotor(Object * o1, Object * o2);
|
||||||
void removeObject(int id);
|
void removeObject(int id);
|
||||||
int cloneObject(const Object * obj);
|
int cloneObject(const Object * obj);
|
||||||
Object * getObject(int id);
|
Object * getObject(int id);
|
||||||
@ -209,6 +211,7 @@ class Engine
|
|||||||
std::string m_engine_path;
|
std::string m_engine_path;
|
||||||
OdeWorld m_world;
|
OdeWorld m_world;
|
||||||
std::map<int, Object *> m_objects;
|
std::map<int, Object *> m_objects;
|
||||||
|
std::map<int, dJointID> m_joints;
|
||||||
int m_next_object_index;
|
int m_next_object_index;
|
||||||
int m_next_text_index;
|
int m_next_text_index;
|
||||||
GLdouble m_eye[3];
|
GLdouble m_eye[3];
|
||||||
|
13
ag.cc
13
ag.cc
@ -98,6 +98,19 @@ namespace ag
|
|||||||
"end\n"
|
"end\n"
|
||||||
|
|
||||||
"ag.createAMotor = function(obj1, obj2, axis1, axis2, axis3)\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"
|
"end\n"
|
||||||
);
|
);
|
||||||
lua_pcall(L, 0, 0, 0);
|
lua_pcall(L, 0, 0, 0);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user