aboutsummaryrefslogtreecommitdiff
path: root/src/client/lua_api/phys/butil.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/lua_api/phys/butil.cpp')
-rw-r--r--src/client/lua_api/phys/butil.cpp26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/client/lua_api/phys/butil.cpp b/src/client/lua_api/phys/butil.cpp
new file mode 100644
index 0000000..6319688
--- /dev/null
+++ b/src/client/lua_api/phys/butil.cpp
@@ -0,0 +1,26 @@
+#include <stdio.h>
+
+extern "C" {
+ #include <lua.h>
+ #include <lauxlib.h>
+ #include <lualib.h>
+}
+
+#include <btBulletDynamicsCommon.h>
+
+#include "butil.hpp"
+
+btVector3 lua_popbtvector(lua_State* L,int pos){
+ f32 p[3];
+
+ for(int i = 0; i < 3; i++){
+ lua_pushnumber(L,i+1);
+ lua_gettable(L,pos);
+ p[i] = (f32) lua_tonumber(L,-1);
+ lua_pop(L,1);
+ }
+
+ printf("Found vector (%f,%f,%f)\n",p[0],p[1],p[2]);
+
+ return btVector3(p[0],p[1],p[2]);
+}