From 44a1421c393632978d59c0698a93ae22243b97e9 Mon Sep 17 00:00:00 2001 From: Alexander Date: Wed, 10 Jun 2020 20:39:54 -0400 Subject: Various progress for 1klutz Added convext shape casts, still a little broken, but it might be just broken bullet side. --- src/shared/lua_api/phys/bhingeconstraint.cpp | 122 +++++++++++++-------------- 1 file changed, 61 insertions(+), 61 deletions(-) (limited to 'src/shared/lua_api/phys/bhingeconstraint.cpp') diff --git a/src/shared/lua_api/phys/bhingeconstraint.cpp b/src/shared/lua_api/phys/bhingeconstraint.cpp index a8c6567..5045cb7 100644 --- a/src/shared/lua_api/phys/bhingeconstraint.cpp +++ b/src/shared/lua_api/phys/bhingeconstraint.cpp @@ -1,61 +1,61 @@ - -#include -#include -#include -extern "C" { - #include - #include - #include -} -#include -#include -#include - -extern btDiscreteDynamicsWorld* World; -extern std::list Objects; - -//newhingeconstraint(phys1,v3 axis, refrencephys1) -int newbhingeconstraint(lua_State *L){ - bool phys1 = lua_toboolean(L,-1) == 1; - lua_pop(L,1); - - double x,y,z; - popvector3d(L,&x,&y,&z); - - lua_getfield(L,-1,"rigidbody"); - btRigidBody *p1 = (btRigidBody*)lua_touserdata(L,-1); - btTransform frame = p1->getCenterOfMassTransform(); - frame.setRotation(btQuaternion(x,y,z,0)); - lua_pop(L,2); - - btHingeConstraint(*p1,frame,phys1); - printf("Done makeing new hinge constraint\n"); - - return 0; -} - -static const luaL_reg hingeconstraint_m[] = { -// {"delete", delbphysbox},//client side delete needs to delete the visual representation - {0, 0}, -}; - -void bhingeconstraint_register(lua_State* L){ - lua_getglobal(L,"phys");//{} - lua_pushcfunction(L,newbhingeconstraint);//{},newhingeconstraint() - lua_setfield(L,-2,"newhingeconstraint");//{} - - lua_pop(L,1);// - - luaL_newmetatable(L,"phys.hingeconstraint"); - lua_newtable(L);//phys.hingeconstraint,{} - luaL_register(L,NULL,hingeconstraint_m); - //luaL_register(L,NULL,cbphysbox_m);//phys.hingeconstraint,{} - lua_setfield(L,-2,"__index");//phys.physbox - - lua_pop(L,1); - - //printf("When registering physbox, new() is %p\n",newcbphysbox); - //printf("setpos is %p\n",cbphyssetpos); - - lua_pop(L,1); -} + +#include +#include +#include +extern "C" { + #include + #include + #include +} +#include +#include +#include + +extern btDiscreteDynamicsWorld* World; +extern std::list Objects; + +//newhingeconstraint(phys1,v3 axis, refrencephys1) +int newbhingeconstraint(lua_State *L){ + bool phys1 = lua_toboolean(L,-1) == 1; + lua_pop(L,1); + + double x,y,z; + popvector3d(L,&x,&y,&z); + + lua_getfield(L,-1,"rigidbody"); + btRigidBody *p1 = (btRigidBody*)lua_touserdata(L,-1); + btTransform frame = p1->getCenterOfMassTransform(); + frame.setRotation(btQuaternion(x,y,z,0)); + lua_pop(L,2); + + btHingeConstraint(*p1,frame,phys1); + printf("Done makeing new hinge constraint\n"); + + return 0; +} + +static const luaL_reg hingeconstraint_m[] = { +// {"delete", delbphysbox},//client side delete needs to delete the visual representation + {0, 0}, +}; + +void bhingeconstraint_register(lua_State* L){ + lua_getglobal(L,"phys");//{} + lua_pushcfunction(L,newbhingeconstraint);//{},newhingeconstraint() + lua_setfield(L,-2,"newhingeconstraint");//{} + + lua_pop(L,1);// + + luaL_newmetatable(L,"phys.hingeconstraint"); + lua_newtable(L);//phys.hingeconstraint,{} + luaL_register(L,NULL,hingeconstraint_m); + //luaL_register(L,NULL,cbphysbox_m);//phys.hingeconstraint,{} + lua_setfield(L,-2,"__index");//phys.physbox + + lua_pop(L,1); + + //printf("When registering physbox, new() is %p\n",newcbphysbox); + //printf("setpos is %p\n",cbphyssetpos); + + lua_pop(L,1); +} -- cgit v1.2.3-70-g09d2