added Engine::Object::setGravityMode()
git-svn-id: svn://anubis/anaglym/trunk@237 99a6e188-d820-4881-8870-2d33a10e2619
This commit is contained in:
parent
f07e0b69f3
commit
d26bf27114
4
Engine.h
4
Engine.h
@ -78,6 +78,10 @@ class Engine
|
||||
void setMass(dReal mass) { m_ode_object->setMass(mass); }
|
||||
const float * getAABB() { return m_aabb; }
|
||||
dBodyID getBody() { return m_ode_object->getBody(); }
|
||||
void setGravityMode(bool enabled)
|
||||
{
|
||||
m_ode_object->setGravityMode(enabled);
|
||||
}
|
||||
|
||||
protected:
|
||||
void createManagedObject();
|
||||
|
16
ag.cc
16
ag.cc
@ -248,6 +248,8 @@ namespace ag
|
||||
lua_setfield(L, -2, "addTorqueRel");
|
||||
lua_pushcfunction(L, object::setColor);
|
||||
lua_setfield(L, -2, "setColor");
|
||||
lua_pushcfunction(L, object::setGravityMode);
|
||||
lua_setfield(L, -2, "setGravityMode");
|
||||
lua_pushcfunction(L, object::setTexture);
|
||||
lua_setfield(L, -2, "setTexture");
|
||||
lua_pushcfunction(L, object::setTextureScale);
|
||||
@ -1164,6 +1166,20 @@ namespace ag
|
||||
return 0;
|
||||
}
|
||||
|
||||
int setGravityMode(lua_State * L)
|
||||
{
|
||||
int argc = lua_gettop(L);
|
||||
if (argc == 2 && lua_isboolean(L, 2))
|
||||
{
|
||||
Engine::Object * obj = getObject(L, 1);
|
||||
if (obj != NULL)
|
||||
{
|
||||
obj->setGravityMode(lua_toboolean(L, 2));
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int setTexture(lua_State * L)
|
||||
{
|
||||
int argc = lua_gettop(L);
|
||||
|
1
ag.h
1
ag.h
@ -81,6 +81,7 @@ namespace ag
|
||||
int addTorque(lua_State * L);
|
||||
int addTorqueRel(lua_State * L);
|
||||
int setColor(lua_State * L);
|
||||
int setGravityMode(lua_State * L);
|
||||
int setTexture(lua_State * L);
|
||||
int setTextureScale(lua_State * L);
|
||||
int getMass(lua_State * L);
|
||||
|
@ -43,5 +43,8 @@ function key_down_event(key)
|
||||
init_obj(box)
|
||||
ag.createAMotor(0, box,
|
||||
{ x = 0, y = 0, z = 1, vel = 10, fmax = 10 })
|
||||
local x, y, z = box:getPosition()
|
||||
box:setPosition(x, y, 2)
|
||||
box:setGravityMode(false)
|
||||
end
|
||||
end
|
||||
|
Loading…
x
Reference in New Issue
Block a user