From 2009501214f3c2e3f8d8b1a06432afdf39276bd5 Mon Sep 17 00:00:00 2001 From: Alexander Pickering Date: Wed, 7 Nov 2018 14:49:35 -0500 Subject: Added Kinematic Character Controllers --- src/client/main.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'src/client/main.cpp') diff --git a/src/client/main.cpp b/src/client/main.cpp index bc509c7..e8533d8 100644 --- a/src/client/main.cpp +++ b/src/client/main.cpp @@ -10,6 +10,7 @@ extern "C" { #include #include +#include #include #include "initdevice.hpp" @@ -20,6 +21,7 @@ extern "C" { #include "lua_api/load_cphys.hpp" #include "lua_api/load_video.hpp" #include "lua_api/load_io.hpp" +#include #include "callbackhandeler.hpp" #include @@ -49,6 +51,7 @@ void loadIrrLibs(lua_State* L, IrrlichtDevice* device){ printf("[OK]\n"); printf("Loading physfuncs..."); load_physfuncs(L); + load_cphysfuncs(L); printf("[OK]\n"); printf("Loading videofuncs..."); load_videofuncs(L); @@ -56,12 +59,18 @@ void loadIrrLibs(lua_State* L, IrrlichtDevice* device){ load_iofuncs(L); } -void RemoveISceneNode(btRigidBody* rb){ +void dropRigidBody(btRigidBody* rb){ ISceneNode *Node = static_cast(rb->getUserPointer()); if(Node) Node->remove(); } +void dropChar(btKinematicCharacterController *a){ + ISceneNode *node = (ISceneNode*)a->getGhostObject()->getUserPointer(); + if(node) + node->remove(); +} + // Converts a quaternion to an euler angle void QuaternionToEuler(const btQuaternion &TQuat, btVector3 &TEuler) { btScalar W = TQuat.getW(); @@ -202,7 +211,8 @@ int main(int argc, char *argv[]){ lua_pop(state,2); } } - phys_shutdown(RemoveISceneNode); + //phys_shutdown(RemoveISceneNode); + phys_shutdown(); device->drop(); printf("Goodbye\n"); -- cgit v1.2.3-70-g09d2