summaryrefslogtreecommitdiff
path: root/src/ode/geom.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/ode/geom.c')
-rw-r--r--src/ode/geom.c39
1 files changed, 39 insertions, 0 deletions
diff --git a/src/ode/geom.c b/src/ode/geom.c
index 9700079..31fbdca 100644
--- a/src/ode/geom.c
+++ b/src/ode/geom.c
@@ -75,6 +75,45 @@ void ode_push_heightfielddata(lua_State *L, dHeightfieldDataID d)
}
+int ContactGeomTable(lua_State *L)
+{
+ luaL_checktype(L, 1, LUA_TUSERDATA);
+ dContactGeom *cgu = lua_touserdata(L, 1);
+ lua_createtable(L, 0, 5);
+ int tbl = lua_gettop(L);
+
+ lua_createtable(L, 3, 0);
+ int pos = lua_gettop(L);
+ lua_pushnumber(L, cgu->pos[0]);
+ lua_rawseti(L, pos, 1);
+ lua_pushnumber(L, cgu->pos[1]);
+ lua_rawseti(L, pos, 2);
+ lua_pushnumber(L, cgu->pos[2]);
+ lua_rawseti(L, pos, 3);
+ lua_setfield(L, tbl, "pos");
+
+ lua_createtable(L, 3, 0);
+ int normal = lua_gettop(L);
+ lua_pushnumber(L, cgu->normal[0]);
+ lua_rawseti(L, normal, 1);
+ lua_pushnumber(L, cgu->normal[1]);
+ lua_rawseti(L, normal, 2);
+ lua_pushnumber(L, cgu->normal[2]);
+ lua_rawseti(L, normal, 3);
+ lua_setfield(L, tbl, "normal");
+
+ lua_pushnumber(L, cgu->depth);
+ lua_setfield(L, tbl, "depth");
+
+ ode_push_geom(L, cgu->g1);
+ lua_setfield(L, tbl, "g1");
+ ode_push_geom(L, cgu->g2);
+ lua_setfield(L, tbl, "g2");
+
+ return 1;
+}
+
+
int dGeomDestroy_bind(lua_State *L)
{
dGeomID *g = luaL_checkudata(L, 1, ode_geom_tname);