diff options
Diffstat (limited to 'src/shared/lua_api/phys/bphysbox.cpp')
| -rw-r--r-- | src/shared/lua_api/phys/bphysbox.cpp | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/src/shared/lua_api/phys/bphysbox.cpp b/src/shared/lua_api/phys/bphysbox.cpp index 3036cf9..78f1c45 100644 --- a/src/shared/lua_api/phys/bphysbox.cpp +++ b/src/shared/lua_api/phys/bphysbox.cpp @@ -45,25 +45,34 @@ void makenewbphysbox(lua_State* L){ btVector3 pos = btVector3(px,py,pz); // Set the initial position of the object - btTransform transform; - transform.setIdentity(); - transform.setOrigin(pos); + btTransform transform = btTransform(btQuaternion(0,0,0,1),pos); + //transform.setIdentity(); + //transform.setOrigin(pos); // Give it a default MotionState btDefaultMotionState* motionstate = new btDefaultMotionState(transform); - + if(!motionstate){ + printf("No motionstate\n"); + } // Create the shape btCollisionShape* shape = new btBoxShape(vshape); + if(!shape){ + printf("no shape\n"); + } // Add mass - btVector3 localinertia; + btVector3 localinertia = btVector3(0,0,0); shape->calculateLocalInertia(mass, localinertia); // Create the rigid body object btRigidBody* rigidbody = new btRigidBody(mass, motionstate, shape, localinertia); + if(!rigidbody){ + printf("No rigidbody\n"); + } // Add it to the world World->addRigidBody(rigidbody); + printf("Added rigid body to world: %p\n",World); Objects.push_back(rigidbody); lua_pushlightuserdata(L,rigidbody);//ud_rigidbody @@ -114,6 +123,7 @@ static int bphyssetpos(lua_State *L){//self,{v3 pos} bt.setOrigin(to); ms->setWorldTransform(bt); i->activate(); + lua_pop(L,1);// return 0; } @@ -139,6 +149,7 @@ static const luaL_reg bphysbox_m[] = { }; void bphysbox_register(lua_State* L){// + printf("Registered bphysbox\n"); luaL_newmetatable(L, "phys.physbox");//{phys.physbox} lua_newtable(L);//{phys.physbox},{} |
