diff options
Diffstat (limited to 'src/shared/lua_api/phys/bhingeconstraint.cpp')
| -rw-r--r-- | src/shared/lua_api/phys/bhingeconstraint.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/shared/lua_api/phys/bhingeconstraint.cpp b/src/shared/lua_api/phys/bhingeconstraint.cpp index 168d1b6..ab6fb50 100644 --- a/src/shared/lua_api/phys/bhingeconstraint.cpp +++ b/src/shared/lua_api/phys/bhingeconstraint.cpp @@ -7,6 +7,7 @@ extern "C" { #include <lauxlib.h> #include <lualib.h> } +#include <shared/lua_api/common.hpp> #include <Irrlicht.h> #include <btBulletDynamicsCommon.h> #include <shared/lua_api/phys/bhingeconstraint.hpp> @@ -19,7 +20,23 @@ using namespace video; extern btDiscreteDynamicsWorld* World; extern std::list<btRigidBody*> 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; } |
