From ececf2c8624f4d95d9413686839f7fa6e5bb5044 Mon Sep 17 00:00:00 2001 From: Alexander Date: Tue, 2 Jun 2020 08:54:14 -0400 Subject: Add a shape cast Add a raycast like function, which can cast shapes. phys.shapecast(), along with a shape structure needed to call this function. --- src/shared/lua_api/phys/bcharactercontroller.cpp | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'src/shared/lua_api/phys/bcharactercontroller.cpp') diff --git a/src/shared/lua_api/phys/bcharactercontroller.cpp b/src/shared/lua_api/phys/bcharactercontroller.cpp index 4dfe791..f61aca5 100644 --- a/src/shared/lua_api/phys/bcharactercontroller.cpp +++ b/src/shared/lua_api/phys/bcharactercontroller.cpp @@ -101,7 +101,7 @@ void makenewbcharactercontroller(lua_State* L){ World->addCollisionObject(ghost,btBroadphaseProxy::CharacterFilter, btBroadphaseProxy::StaticFilter|btBroadphaseProxy::DefaultFilter); //ghost->setCollisionFlags(btCollisionObject::CF_CHARACTER_OBJECT); printf("Character controller created\n"); - btKinematicCharacterController *cc = new btKinematicCharacterController(ghost, cshape, 8, btVector3(0,1,0)); + btKinematicCharacterController *cc = new btKinematicCharacterController(ghost, cshape, 1, btVector3(0,1,0)); //cc->setMaxSlope(3.14 / 4.0); //cinfo.m_friction = 0; @@ -177,9 +177,10 @@ int bcharactersetpos(lua_State *L){ double x,y,z; popvector3d(L,&x,&y,&z); btKinematicCharacterController *c = popCharacter(L); - btTransform t = c->getGhostObject()->getWorldTransform(); - t.setOrigin(btVector3(x,y,z)); - c->getGhostObject()->setWorldTransform(t); + c->warp(btVector3(x,y,z)); + //btTransform t = c->getGhostObject()->getWorldTransform(); + //t.setOrigin(btVector3(x,y,z)); + //c->getGhostObject()->setWorldTransform(t); return 0; } @@ -192,13 +193,13 @@ int bcharacteronground(lua_State *L){ // char:jump(v3 jump) int bcharacterjump(lua_State *L){ - printf("Jump called\n"); + //printf("Jump called\n"); double x,y,z; popvector3d(L,&x,&y,&z); btKinematicCharacterController *c = popCharacter(L); - printf("About to jump\n"); + //printf("About to jump\n"); c->jump(btVector3(x,y,z)); - printf("Done jumping\n"); + //printf("Done jumping\n"); return 0; } -- cgit v1.2.3-70-g09d2