diff options
| author | Alexander <alex@cogarr.net> | 2020-05-18 13:41:40 -0400 |
|---|---|---|
| committer | Alexander <alex@cogarr.net> | 2020-05-18 13:41:40 -0400 |
| commit | 355589a9100c7d08fdc4094ad32eb9852c88fcc4 (patch) | |
| tree | 9e2d2ce6b736539907fc06fc3acc2c23daadafac | |
| parent | 377ca5d31a35009913a795c8542659e4872d7c35 (diff) | |
| download | brokengine-355589a9100c7d08fdc4094ad32eb9852c88fcc4.tar.gz brokengine-355589a9100c7d08fdc4094ad32eb9852c88fcc4.tar.bz2 brokengine-355589a9100c7d08fdc4094ad32eb9852c88fcc4.zip | |
various updates
| -rw-r--r-- | src/client/lua_api/gui/iguibutton.cpp | 6 | ||||
| -rw-r--r-- | src/client/lua_api/load_video.cpp | 1 | ||||
| -rw-r--r-- | src/client/lua_api/phys/cbcharactercontroller.cpp | 9 | ||||
| -rw-r--r-- | src/shared/lua_api/load_net.cpp | 45 | ||||
| -rw-r--r-- | src/shared/lua_api/phys/bcharactercontroller.cpp | 197 | ||||
| -rw-r--r-- | src/shared/lua_api/phys/bcharactercontroller.hpp | 1 | ||||
| -rw-r--r-- | src/shared/lua_api/phys/bphysgeneric.cpp | 20 | ||||
| -rw-r--r-- | src/shared/lua_api/phys/bphysmodel.cpp | 48 | ||||
| -rw-r--r-- | src/shared/phys/physcommon.cpp | 2 |
9 files changed, 255 insertions, 74 deletions
diff --git a/src/client/lua_api/gui/iguibutton.cpp b/src/client/lua_api/gui/iguibutton.cpp index b8ff517..3d4580b 100644 --- a/src/client/lua_api/gui/iguibutton.cpp +++ b/src/client/lua_api/gui/iguibutton.cpp @@ -47,13 +47,17 @@ static int newiguibutton(lua_State* L){ //printf("Createing gui button!\n"); int nargs = lua_gettop(L); + if(nargs > 3 || nargs < 2){ + lua_pop(L,nargs); + lua_pushstring(L,"Incorrect number of arguments for gui.newbutton(rect,\"text\"[,parent])"); + lua_error(L); + } IGUIElement* parent = NULL; if(nargs == 3){ lua_getfield(L,-1,"guielement"); parent = (IGUIElement*)lua_touserdata(L,-1); lua_pop(L,2);//{{sx,sy},{ex,ey}},"text" } - const char* label_c = lua_tostring(L,-1);//{{sx,sy},{ex,ey}},"text" size_t label_c_len = strlen(label_c); wchar_t label_w[label_c_len + 1] = L""; diff --git a/src/client/lua_api/load_video.cpp b/src/client/lua_api/load_video.cpp index b3487ca..73be550 100644 --- a/src/client/lua_api/load_video.cpp +++ b/src/client/lua_api/load_video.cpp @@ -89,6 +89,7 @@ int draw3dline(lua_State* L){ popvector3d(L,&ex,&ey,&ez); popvector3d(L,&sx,&sy,&sz); + driver->setTransform(video::ETS_WORLD, core::IdentityMatrix); driver->draw3DLine(vector3df(sx,sy,sz),vector3df(ex,ey,ez),SColor(a,r,g,b)); return 0; diff --git a/src/client/lua_api/phys/cbcharactercontroller.cpp b/src/client/lua_api/phys/cbcharactercontroller.cpp index 16ad1ad..f93d01a 100644 --- a/src/client/lua_api/phys/cbcharactercontroller.cpp +++ b/src/client/lua_api/phys/cbcharactercontroller.cpp @@ -9,6 +9,7 @@ extern "C" { #include <btBulletDynamicsCommon.h> #include <BulletDynamics/Character/btKinematicCharacterController.h> +#include <BulletCollision/CollisionDispatch/btGhostObject.h> #include <irrlicht.h> #include "cbphysbox.hpp" #include "../scene/imesh.hpp" @@ -49,6 +50,7 @@ static int newcbcharactercontroller(lua_State* L){// ISceneNode* n = (ISceneNode*)lua_touserdata(L,-1);//ud_iscenenode lua_pop(L,1); + cc->getGhostObject()->setUserPointer(n); //cc->setUserPointer(n);//TODO: what does this break? lua_newtable(L);//{} @@ -56,6 +58,8 @@ static int newcbcharactercontroller(lua_State* L){// lua_setfield(L,-2,"character");//{} lua_pushlightuserdata(L,n);//{},ud_iscenenode lua_setfield(L,-2,"node");//{} + lua_pushstring(L,"character"); + lua_setfield(L,-2,"type"); luaL_getmetatable(L,"phys.charactercontroller");//{},{phys.charactercontroller} lua_setmetatable(L,-2);//{} @@ -102,12 +106,13 @@ void cbcharactercontroller_register(lua_State* L){ lua_setfield(L,-2,"newccharactercontroller");//{} lua_pop(L,1);// - + luaL_getmetatable(L,"phys.charactercontroller");//phys.physbox lua_newtable(L);//phys.physbox,{} - luaL_register(L,NULL,brigidbody_m); + //luaL_register(L,NULL,brigidbody_m); luaL_register(L,NULL,igeneric_m); luaL_register(L,NULL,cbcharactercontroller_m);//phys.physbox,{} + luaL_register(L,NULL,bcharactercontroller_m); lua_setfield(L,-2,"__index");//phys.physbox lua_pop(L,1); diff --git a/src/shared/lua_api/load_net.cpp b/src/shared/lua_api/load_net.cpp index 3452aa2..b377cc5 100644 --- a/src/shared/lua_api/load_net.cpp +++ b/src/shared/lua_api/load_net.cpp @@ -69,6 +69,7 @@ extern "C" { 1 to 1 protocol. @field PAIR 1 */ +#define PAIR 1 /*** Many to many protocol. @@ -76,36 +77,62 @@ When this socket sends messages, it does not receive a copy of the message it just sent. @field BUS 2 */ +#define BUS 2 /*** Publish protocol. The first half of the pub/sub protocol. @field PUB 3 */ +#define PUB 3 /*** Subscribe protocol The second half of the pub/sub protocol. @field SUB 4 */ +#define SUB 4 /*** +Pull protocol. +The first half of the push/pull protocol. @field PULL 5 -@field PUSH 6 -@field REQ 7 -@field REP 8 -@field RESPOND 9 -@field SURVEY 10 */ -#define PAIR 1 -#define BUS 2 -#define PUB 3 -#define SUB 4 #define PULL 5 + +/*** +Push protocol. +The second half of the push/pull protocol. +@field PUSH 6 +*/ #define PUSH 6 + +/*** +Request protocol. +The first half of the request/reply protocol. +@field REQ 7 +*/ #define REQ 7 + +/*** +Reply protocol. +The second half of the request/reply protocol. +@field REP 8 +*/ #define REP 8 + +/*** +Respond protocol. +The second half of the survey/respond protocol. +@field RESPOND 9 +*/ #define RESPOND 9 + +/*** +Survey protocol. +The first half of the survey/respond protocol. +@field SURVEY 10 +*/ #define SURVEY 10 //Some defines for things that the library dosn't have diff --git a/src/shared/lua_api/phys/bcharactercontroller.cpp b/src/shared/lua_api/phys/bcharactercontroller.cpp index 0f3096c..4dfe791 100644 --- a/src/shared/lua_api/phys/bcharactercontroller.cpp +++ b/src/shared/lua_api/phys/bcharactercontroller.cpp @@ -15,8 +15,35 @@ extern "C" { #include <shared/lua_api/common.hpp> extern btDiscreteDynamicsWorld* World; -extern std::list<btRigidBody*> Objects; +extern std::list<btCollisionObject*> Objects; extern std::list<btKinematicCharacterController*> Chars; + +//{character} :: btKinematicCharacterController* +btKinematicCharacterController *popCharacter(lua_State *L){ + lua_getfield(L,-1,"type");//{char},"type" + if(lua_isnil(L,-1)){ + lua_pushstring(L,"Tried to call a character method on something that had not 'type'"); + lua_error(L); + } + const char *s = lua_tostring(L,-1);//{char},"type" + if(strcmp(s,"character")!= 0){ + printf("Tried to pop character when it was not a character!\n"); + lua_pushstring(L,"Tried to call a character method on a "); + lua_pushstring(L,s); + lua_concat(L,2); + lua_error(L); + } + lua_getfield(L,-2,"character");//{char},"type",ud_character + if(lua_isnil(L,-1)){ + printf("Failed to get a \"character\" field\n"); + lua_pushstring(L,"Character object was not set up correctly\n"); + lua_error(L); + } + btKinematicCharacterController *c = (btKinematicCharacterController*)lua_touserdata(L,-1); + lua_pop(L,3); + return c; + +} /* static LBPhysNode* checkisbphysbox(lua_State* L, int index){ void* ud = luaL_checkudata(L,index,"phys.physbox"); @@ -32,8 +59,9 @@ static LISceneNode* checkismesh(lua_State* L){ */ // ud_character :: ({v3 size}, {v3 origin}) void makenewbcharactercontroller(lua_State* L){ - lua_pushstring(L,"Character controller is totally fucking broken for now\n"); - lua_error(L); + printf("Creating new character controller\n"); + //lua_pushstring(L,"Character controller is totally fucking broken for now\n"); + //lua_error(L); double px,py,pz; //position double sx,sy,sz; //size //double mass; @@ -43,11 +71,11 @@ void makenewbcharactercontroller(lua_State* L){ //printf("Got mass: %f\n",mass); popvector3d(L,&px,&py,&pz);//{v3_size} - //printf("Got position: (%f,%f,%f)\n",px,py,pz); + printf("Got position: (%f,%f,%f)\n",px,py,pz); popvector3d(L,&sx,&sy,&sz);// btVector3 vshape = btVector3(sx * 0.5f, sy * 0.5f, sz * 0.5f); - //printf("Got size: (%f,%f,%f)\n",sx,sy,sz); + printf("Got size: (%f,%f,%f)\n",sx,sy,sz); btVector3 pos = btVector3(px,py,pz); btTransform transform = btTransform(btQuaternion(0,0,0,1),pos); @@ -70,43 +98,115 @@ void makenewbcharactercontroller(lua_State* L){ btPairCachingGhostObject *ghost = new btPairCachingGhostObject(); ghost->setWorldTransform(transform); ghost->setCollisionShape(cshape); - ghost->setCollisionFlags(btCollisionObject::CF_CHARACTER_OBJECT); - btKinematicCharacterController *cc = new btKinematicCharacterController(ghost, cshape, 1, btVector3(0,1,0)); + 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)); + //cc->setMaxSlope(3.14 / 4.0); //cinfo.m_friction = 0; - //btRigidBody *rigidbody = new btRigidBody(cinfo); // Add it to the world + printf("About to add action\n"); World->addAction(cc); - //World->addVehicle(cc); + printf("Finished adding action\n"); //printf("Added rigid body to world: %p\n",World); - Chars.push_back(cc); + printf("Added to Chars\n"); + //Chars.push_back(cc); + //Objects.push_back(ghost); lua_pushlightuserdata(L,cc);//ud_cc } +// char:getvelocity() +int bcharactergetvelocity(lua_State *L){ + btKinematicCharacterController *r = popCharacter(L); + btVector3 v = r->getLinearVelocity(); + pushvector3d(L,v.x(),v.y(),v.z()); + return 1; +} + +// char:setvelocity(v3 vel) +int bcharactersetvelocity(lua_State *L){ + double x,y,z; + popvector3d(L,&x,&y,&z); + btKinematicCharacterController *r = popCharacter(L); + r->setLinearVelocity(btVector3(x,y,z)); + return 0; +} + // phys.newphysbox(vector3 size, vector3 origin, double mass) int newbcharactercontroller(lua_State* L){ //printf("Createing bphysbox!\n"); //Create it's lua representation makenewbcharactercontroller(L);//ud_cc - btKinematicCharacterController* r = (btKinematicCharacterController*)lua_touserdata(L,-1); - lua_pop(L,1); + btKinematicCharacterController* r = (btKinematicCharacterController*)lua_touserdata(L,-1);//ud_cc + lua_pop(L,1);// lua_newtable(L);//{} - lua_pushlightuserdata(L,r);//ud_cc - lua_setfield(L,-2,"character");//{} + lua_pushlightuserdata(L,r);//{},ud_cc + lua_setfield(L,-2,"character");//{character=ud_cc} + + lua_pushstring(L,"character"); + lua_setfield(L,-2,"type");//{character=ud_cc,type="character"} //Set it's metatable luaL_getmetatable(L, "phys.charactercontroller");//{},{phys.charactercontroller} - lua_setmetatable(L, -2);//{} + lua_setmetatable(L, -2);//{cc} return 1; } +// char:setgravity(v3 gravity) +int bcharactersetgravity(lua_State *L){ + double x,y,z; + popvector3d(L,&x,&y,&z); + btKinematicCharacterController *c = popCharacter(L); + c->setGravity(btVector3(x,y,z)); + return 0; +} + +// char:getpos() :: v3 +int bcharactergetpos(lua_State *L){ + btKinematicCharacterController *c = popCharacter(L); + btVector3 pos = c->getGhostObject()->getWorldTransform().getOrigin(); + pushvector3d(L,pos.x(),pos.y(),pos.z()); + return 1; +} + +// char:setpos(v3 pos) +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); + return 0; +} + +// char:onground() +int bcharacteronground(lua_State *L){ + btKinematicCharacterController *c = popCharacter(L); + lua_pushboolean(L,c->onGround() == true ? 1 : 0); + return 1; +} + +// char:jump(v3 jump) +int bcharacterjump(lua_State *L){ + printf("Jump called\n"); + double x,y,z; + popvector3d(L,&x,&y,&z); + btKinematicCharacterController *c = popCharacter(L); + printf("About to jump\n"); + c->jump(btVector3(x,y,z)); + printf("Done jumping\n"); + return 0; +} + //{phys.physbox}:delete() static int delbcharactercontroller(lua_State* L){//self //printf("Attempting to delete physbox\n"); - lua_getfield(L,-1,"character");//self,ud_rigidbody - btKinematicCharacterController* r = (btKinematicCharacterController*)lua_touserdata(L,-1);//self,ud_rigidbody + lua_getfield(L,-1,"character");//self,ud_character + btKinematicCharacterController* r = (btKinematicCharacterController*)lua_touserdata(L,-1);//self,ud_character lua_pop(L,2); delete r->getGhostObject(); delete r; @@ -124,25 +224,76 @@ int bcharsetwalkdirection(lua_State *L){ return 0; } -static const luaL_reg bcharactercontroller_m[] = { +// char:setfallspeed(n) +int bcharactersetfallspeed(lua_State *L){ + double speed = luaL_optnumber(L,-1,1); + printf("Got number: %f\n",speed); + lua_pop(L,1); + btKinematicCharacterController *c = popCharacter(L); + printf("About to set speed\n"); + c->setFallSpeed(speed); + printf("Done setting speed\n"); + return 0; +} + +// char:getmaxslope() +int bcharactergetmaxslope(lua_State *L){ + btKinematicCharacterController *c = popCharacter(L); + btScalar s = c->getMaxSlope(); + lua_pushnumber(L,s); + return 1; +} + +// char:setmaxslope(slope) +int bcharactersetmaxslope(lua_State *L){ + btScalar s = lua_tonumber(L,-1); + lua_pop(L,1); + btKinematicCharacterController *c = popCharacter(L); + c->setMaxSlope(s); + return 0; +} + +// char:setvelocityforinterval(vec3 {velocity},number interval) +int bcharactersetvelocityforinterval(lua_State *L){ + double interval = lua_tonumber(L,-1); + lua_pop(L,1); + double x,y,z; + popvector3d(L,&x,&y,&z); + btKinematicCharacterController *c = popCharacter(L); + c->setVelocityForTimeInterval(btVector3(x,y,z),interval); + return 0; +} + +extern const luaL_reg bcharactercontroller_m[] = { {"setwalkdir", bcharsetwalkdirection}, {"remove", delbcharactercontroller}, + {"getvelocity", bcharactergetvelocity}, + {"setvelocity", bcharactersetvelocity}, + {"setgravity", bcharactersetgravity}, + {"getpos", bcharactergetpos}, + {"setpos", bcharactersetpos}, + {"onground", bcharacteronground}, + {"jump", bcharacterjump}, + {"setfallspeed", bcharactersetfallspeed}, + {"getmaxslope", bcharactergetmaxslope}, + {"setmaxslope", bcharactersetmaxslope}, + {"setvelocityforinterval",bcharactersetvelocityforinterval}, {0, 0}, }; void bcharactercontroller_register(lua_State* L){// //printf("Registered bphysbox\n"); - luaL_newmetatable(L, "phys.charactercontroller");//{phys.physbox} - lua_newtable(L);//{phys.physbox},{} - luaL_register(L,NULL,bcharactercontroller_m);//{phys.physbox},{} - lua_setfield(L,-2,"__index");//{phys.physbox} + luaL_newmetatable(L, "phys.charactercontroller");//{phys.characontroller} + lua_newtable(L);//{phys.charcontroller},{} + luaL_register(L,NULL,bcharactercontroller_m);//{phys.charcontroller},{} + lua_setfield(L,-2,"__index");//{phys.charcontroller} lua_pop(L,1);// lua_getglobal(L,"phys");//{} lua_pushcfunction(L,newbcharactercontroller);//{},newbcharactercontroller() - lua_setfield(L,-2,"newcharactercontroller");//{} + lua_setfield(L,-2,"newbcharactercontroller");//{} lua_pop(L,1); } diff --git a/src/shared/lua_api/phys/bcharactercontroller.hpp b/src/shared/lua_api/phys/bcharactercontroller.hpp index d6048a5..1c920de 100644 --- a/src/shared/lua_api/phys/bcharactercontroller.hpp +++ b/src/shared/lua_api/phys/bcharactercontroller.hpp @@ -9,3 +9,4 @@ extern "C" { void bcharactercontroller_register(lua_State* L); void makenewbcharactercontroller(lua_State* L); +extern const luaL_reg bcharactercontroller_m[]; diff --git a/src/shared/lua_api/phys/bphysgeneric.cpp b/src/shared/lua_api/phys/bphysgeneric.cpp index 718ffed..4500ce0 100644 --- a/src/shared/lua_api/phys/bphysgeneric.cpp +++ b/src/shared/lua_api/phys/bphysgeneric.cpp @@ -246,6 +246,25 @@ int applyimpulse(lua_State *L){ return 0; } +//rigidbody:setrotation({pitch,yaw,roll}) +int setrotation(lua_State *L){ + int nargs = lua_gettop(L); + double pitch,yaw,roll; + if(nargs != 2){ + lua_pushstring(L,"setrotation() expected 2 arguments (r :: rigidbody, eulerangle :: vector3)"); + lua_error(L); + } + popvector3d(L,&pitch,&yaw,&roll); + btRigidBody *r = popRigidBody(L); + btTransform tr; + btQuaternion quat; + quat.setEuler(yaw,pitch,roll); + tr.setRotation(quat); + r->setCenterOfMassTransform(tr); + + return 0; +} + /* @@ -290,6 +309,7 @@ extern const luaL_reg brigidbody_m[] = { {"setvelocity", setvelocity}, {"setangfactor", setangfactor}, {"setflags", setflags}, + {"setrotation", setrotation}, //{"testcontact", testcontact}, {NULL, NULL} }; diff --git a/src/shared/lua_api/phys/bphysmodel.cpp b/src/shared/lua_api/phys/bphysmodel.cpp index 2c9a02d..0515922 100644 --- a/src/shared/lua_api/phys/bphysmodel.cpp +++ b/src/shared/lua_api/phys/bphysmodel.cpp @@ -74,18 +74,12 @@ void makebphysmodel(lua_State *L){ btVector3 vertexes[attrib.num_vertices]; for(size_t i = 0; i < attrib.num_vertices; i++){ //0 - x, so num_vertices - 1 float *vs = attrib.vertices + (3*i);//3 floats per vertex - //printf("Got start\n"); //For some reason irrlicht and bullet disagree with which direction +x is, //negate the x in the physics engine so the graphical stuff lines up //with the physics stuff float v1 = -vs[0]; - //printf("Got 1\n"); float v2 = vs[1]; - //printf("Got 2\n"); float v3 = vs[2]; - //printf("Got all 3 vertexees\n"); - //printf("Adding vertex: (%f %f %f)\n",v1, v2, v3); - //trimesh->findOrAddVertex(btVector3(v1,v2,v3),true); vertexes[i] = btVector3(v1,v2,v3); } printf("Finished finding or adding vertexes\n"); @@ -94,45 +88,23 @@ void makebphysmodel(lua_State *L){ i1 = attrib.faces[i]; i2 = attrib.faces[i+1]; i3 = attrib.faces[i+2]; - trimesh->addTriangle(vertexes[i1.v_idx],vertexes[i2.v_idx],vertexes[i3.v_idx],true); - //trimesh->addTriangleIndices(i1.v_idx,i2.v_idx,i3.v_idx); + btVector3 v1,v2,v3; + v1 = vertexes[i1.v_idx]; + v2 = vertexes[i2.v_idx]; + v3 = vertexes[i3.v_idx]; + trimesh->addTriangle(vertexes[i1.v_idx],vertexes[i2.v_idx],vertexes[i3.v_idx],true);//Some triangles are "the wrong way round", + trimesh->addTriangle(vertexes[i3.v_idx],vertexes[i2.v_idx],vertexes[i1.v_idx],true);//double-side all triangles } printf("Finished adding triangle indicies\n"); - //size_t numverts = attrib.num_face_num_verts; - ////size_t stride = 9; //9 = 3 position floats + 3 normal floats + 3 color floats - //size_t face_offset = 0; - //for(size_t i = 0; i < numverts; i++){ - //for(size_t j = 0; j < (size_t)attrib.face_num_verts[i] / 3; j++){ - //float v[3][3]; //this tri - //tinyobj_vertex_index_t idx0, idx1, idx2; - //idx0 = attrib.faces[face_offset + 3 * j + 0]; - //idx1 = attrib.faces[face_offset + 3 * j + 1]; - //idx2 = attrib.faces[face_offset + 3 * j + 2]; - //for(short k = 0; k < 3; k++){ - //int f0, f1, f2; - //f0 = idx0.v_idx; - //f1 = idx1.v_idx; - //f2 = idx2.v_idx; - //v[0][k] = attrib.vertices[3 * (size_t)f0 + k]; - //v[1][k] = attrib.vertices[3 * (size_t)f1 + k]; - //v[2][k] = attrib.vertices[3 * (size_t)f2 + k]; - //} - //btVector3 b1,b2,b3; - //b1 = btVector3(v[0][0],v[0][1],v[0][2]); - //b2 = btVector3(v[1][0],v[1][1],v[1][2]); - //b3 = btVector3(v[2][0],v[2][1],v[2][2]); - //trimesh->addTriangle(b1,b2,b3); - //} - //face_offset += (size_t)attrib.face_num_verts[i]; - //} printf("Done building trimesh\n"); - //btCollisionShape *shape = new btGImpactMeshShape(trimesh); - btCollisionShape *shape = new btConvexTriangleMeshShape(trimesh); + btGImpactShapeInterface *shape = new btGImpactMeshShape(trimesh); + shape->updateBound(); + //btCollisionShape *shape = new btBvhTriangleMeshShape(trimesh,true); btTransform tr; tr.setIdentity(); tr.setOrigin(btVector3(x,y,z)); printf("Created default motion shape\n"); - btDefaultMotionState *ms = new btDefaultMotionState(btTransform(tr)); + btDefaultMotionState *ms = new btDefaultMotionState(tr); btVector3 li; shape->calculateLocalInertia(mass, li); btRigidBody *rb = new btRigidBody(mass,ms,shape,li); diff --git a/src/shared/phys/physcommon.cpp b/src/shared/phys/physcommon.cpp index 45374d2..e418ef6 100644 --- a/src/shared/phys/physcommon.cpp +++ b/src/shared/phys/physcommon.cpp @@ -53,7 +53,6 @@ btSequentialImpulseConstraintSolver* Solver; void phys_genesis(){ broadphase = new btAxisSweep3(btVector3(-100000,-100000,-100000),btVector3(100000,100000,100000)); - broadphase ->getOverlappingPairCache()->setInternalGhostPairCallback(new btGhostPairCallback()); //printf("Broadphase\n"); CollisionConfiguration = new btDefaultCollisionConfiguration(); //printf("Collision config\n"); @@ -62,6 +61,7 @@ void phys_genesis(){ Solver = new btSequentialImpulseConstraintSolver(); //printf("Solver\n"); World = new btDiscreteDynamicsWorld(Dispatcher, broadphase, Solver, CollisionConfiguration); + broadphase ->getOverlappingPairCache()->setInternalGhostPairCallback(new btGhostPairCallback()); //printf("Physics world init ok.\n"); World->setGravity(btVector3(0,-10,0)); //printf("Created physics world: %p\n",World); |
