From d5cd0c7b4425e25b11a1ceec154a5c752d508a42 Mon Sep 17 00:00:00 2001 From: Alexander Date: Wed, 26 Jun 2019 16:14:00 -0400 Subject: Major refactor of physics code Move all the physics code into the shared directory, and fix the ghost objects (aabb only) --- src/client/lua_api/phys/cbphysbox.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'src/client/lua_api/phys/cbphysbox.cpp') diff --git a/src/client/lua_api/phys/cbphysbox.cpp b/src/client/lua_api/phys/cbphysbox.cpp index c5aacd8..3c0f97d 100644 --- a/src/client/lua_api/phys/cbphysbox.cpp +++ b/src/client/lua_api/phys/cbphysbox.cpp @@ -51,15 +51,25 @@ static int newcbphysbox(lua_State* L){// pushvector3d(L,x,y,z);//{v3 size},{v3 origin} makenewiscenecube(L);//ud_iscenenode ISceneNode* n = (ISceneNode*)lua_touserdata(L,-1);//ud_iscenenode - lua_pop(L,1); + lua_pop(L,1);// r->setUserPointer(n); lua_newtable(L);//{} + lua_pushlightuserdata(L,r);//{},ud_rigidbody lua_setfield(L,-2,"collider");//{} + lua_pushstring(L,"rigidbody");//{},"rigidbody" + lua_setfield(L,-2,"type");//{} lua_pushlightuserdata(L,n);//{},ud_iscenenode lua_setfield(L,-2,"node");//{} + + lua_getglobal(L,"phys");//{rb},{phys} + lua_getfield(L,-1,"colliders");//{rb},{phys},{phys.colliders} + lua_pushlightuserdata(L,r);//{rb},{phys},{colliders},ud_rb + lua_pushvalue(L,-4);//{rb},{phys},{colliders},ud_rb,{rb} + lua_settable(L,-3);//{rb},{phys},{phys.colliders} + lua_pop(L,2);//{rb} luaL_getmetatable(L,"phys.physbox");//{},{phys.physbox} lua_setmetatable(L,-2);//{} -- cgit v1.2.3-70-g09d2