From 2831e232b886c5e3b0791ea5192f9e5194e6abf3 Mon Sep 17 00:00:00 2001 From: Alexander Pickering Date: Fri, 9 Mar 2018 23:55:49 -0500 Subject: Added IGUIImages Added the ability to display itextures on the gui --- src/shared/lua_api/phys/bphysbox.cpp | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) (limited to 'src/shared/lua_api/phys/bphysbox.cpp') 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},{} -- cgit v1.2.3-70-g09d2