diff options
| author | Alexander <alex@cogarr.net> | 2019-04-24 21:16:08 -0400 |
|---|---|---|
| committer | Alexander <alex@cogarr.net> | 2019-04-24 21:16:08 -0400 |
| commit | 3d60e1432ec43ade4aa61b5a70dd6b8975417e9f (patch) | |
| tree | 954719a0f4a27fe42f9d8113844a21b79ae70f5d /src/shared/lua_api/phys/bcollider.cpp | |
| parent | 42bedce123739287339a95626675ffda3a1ce8e7 (diff) | |
| download | brokengine-3d60e1432ec43ade4aa61b5a70dd6b8975417e9f.tar.gz brokengine-3d60e1432ec43ade4aa61b5a70dd6b8975417e9f.tar.bz2 brokengine-3d60e1432ec43ade4aa61b5a70dd6b8975417e9f.zip | |
updates
Diffstat (limited to 'src/shared/lua_api/phys/bcollider.cpp')
| -rw-r--r-- | src/shared/lua_api/phys/bcollider.cpp | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/src/shared/lua_api/phys/bcollider.cpp b/src/shared/lua_api/phys/bcollider.cpp new file mode 100644 index 0000000..356c504 --- /dev/null +++ b/src/shared/lua_api/phys/bcollider.cpp @@ -0,0 +1,44 @@ +extern "C" { + #include <lua.h> + #include <lauxlib.h> + #include <lualib.h> +} +#include <btBulletDynamicsCommon.h> +#include <shared/lua_api/common.hpp> +#include "bcollider.hpp" + + +/*Collider things from lua have the form of: +{ + type = "ghost" | "multi" | "rigidbody" | "softbody" + collider = ud_btCollisionObject, + node = ud_ISceneNode, --Optional, on client +} +*/ +btCollisionObject* popCollider(lua_State *L){ + lua_getfield(L,-1,"collider"); + btCollisionObject *r = (btCollisionObject*)lua_touserdata(L,-1); + lua_pop(L,2); + return r; +} + +/*** +Activates this object. +If this object was sleeping, it will move again. If you are using +applyforce or setvelocity, you will need to activate() the rigidbody for it +to move. +@function collider:activate() +*/ +//collider:activate() +int activate(lua_State *L){ + btCollisionObject *r = popCollider(L); + + r->activate(); + + return 0; +} + +extern const luaL_reg bcollider_m[] = { + {"activate", activate}, + {NULL, NULL} +}; |
