aboutsummaryrefslogtreecommitdiff
path: root/src/shared/lua_api/phys/bcharactercontroller.cpp
diff options
context:
space:
mode:
authorAlexander <alex@cogarr.net>2020-06-02 08:54:14 -0400
committerAlexander <alex@cogarr.net>2020-06-02 08:54:14 -0400
commitececf2c8624f4d95d9413686839f7fa6e5bb5044 (patch)
treed276a9b7bec1706113f7a59b721fc3c1495cfcbd /src/shared/lua_api/phys/bcharactercontroller.cpp
parent355589a9100c7d08fdc4094ad32eb9852c88fcc4 (diff)
downloadbrokengine-ececf2c8624f4d95d9413686839f7fa6e5bb5044.tar.gz
brokengine-ececf2c8624f4d95d9413686839f7fa6e5bb5044.tar.bz2
brokengine-ececf2c8624f4d95d9413686839f7fa6e5bb5044.zip
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.
Diffstat (limited to 'src/shared/lua_api/phys/bcharactercontroller.cpp')
-rw-r--r--src/shared/lua_api/phys/bcharactercontroller.cpp15
1 files changed, 8 insertions, 7 deletions
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;
}