aboutsummaryrefslogtreecommitdiff
path: root/src/client/lua_api/phys/cbphysbox.cpp
diff options
context:
space:
mode:
authorAlexander <alex@cogarr.net>2019-06-26 16:14:00 -0400
committerAlexander <alex@cogarr.net>2019-06-26 16:14:00 -0400
commitd5cd0c7b4425e25b11a1ceec154a5c752d508a42 (patch)
treeef50cd7d419bba30ee08f46c97232b1c8c68d2be /src/client/lua_api/phys/cbphysbox.cpp
parent3d60e1432ec43ade4aa61b5a70dd6b8975417e9f (diff)
downloadbrokengine-d5cd0c7b4425e25b11a1ceec154a5c752d508a42.tar.gz
brokengine-d5cd0c7b4425e25b11a1ceec154a5c752d508a42.tar.bz2
brokengine-d5cd0c7b4425e25b11a1ceec154a5c752d508a42.zip
Major refactor of physics code
Move all the physics code into the shared directory, and fix the ghost objects (aabb only)
Diffstat (limited to 'src/client/lua_api/phys/cbphysbox.cpp')
-rw-r--r--src/client/lua_api/phys/cbphysbox.cpp12
1 files changed, 11 insertions, 1 deletions
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);//{}