diff options
| author | Alexander Pickering <alexandermpickering@gmail.com> | 2018-03-09 23:55:49 -0500 |
|---|---|---|
| committer | Alexander Pickering <alexandermpickering@gmail.com> | 2018-03-09 23:55:49 -0500 |
| commit | 2831e232b886c5e3b0791ea5192f9e5194e6abf3 (patch) | |
| tree | 4fb9309d18f388673b7a21b8f0e927727006f585 /src/shared/lua_api/phys | |
| parent | 35b7c646fd7f80b64c1ef49b6d81f9df9bc1b940 (diff) | |
| download | brokengine-2831e232b886c5e3b0791ea5192f9e5194e6abf3.tar.gz brokengine-2831e232b886c5e3b0791ea5192f9e5194e6abf3.tar.bz2 brokengine-2831e232b886c5e3b0791ea5192f9e5194e6abf3.zip | |
Added IGUIImages
Added the ability to display itextures on the gui
Diffstat (limited to 'src/shared/lua_api/phys')
| -rw-r--r-- | src/shared/lua_api/phys/bgame.cpp | 13 | ||||
| -rw-r--r-- | src/shared/lua_api/phys/bphysbox.cpp | 21 |
2 files changed, 29 insertions, 5 deletions
diff --git a/src/shared/lua_api/phys/bgame.cpp b/src/shared/lua_api/phys/bgame.cpp new file mode 100644 index 0000000..b755787 --- /dev/null +++ b/src/shared/lua_api/phys/bgame.cpp @@ -0,0 +1,13 @@ +extern "C" { + #include <lua.h> + #include <lauxlib.h> + #include <lualib.h> +} + +#include <btBulletDynamicsCommon.h> + +extern btDiscreteDynamicsWorld* World; + +void registergravity(lua_State* L){ + +} 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},{} |
