Int numManifolds = dynamicsWorld->getDispatcher()->getNumManifolds() stepSimulation seems to only be for letting Bullet set world Transforms?ĭynamicsWorld->contactTest(mPlayerObject, resultCallback) Also tried doing this with stepSimulation(deltaTime, 7), but nothing changed. do the same for my enemies, and then.ĭynamicsWorld->performDiscreteCollisionDetection() MPlayerObject->setWorldTransform(updatedWorld) tOrigin(btVector3(position.x, position.y, position.z)) Then every frame I update all my objects with something like this: btTransform updatedWorld I do essentially the same thing with my enemy objects. MPlayerObject->forceActivationState(DISABLE_DEACTIVATION) //maybe not neededĭynamicsWorld->addCollisionObject(mPlayerObject) MPlayerObject->setWorldTransform(playerWorld) tOrigin(btVector3(playerPos.x, playerPos.y, playerPos.z)) playerPos is a D3DXVECTOR3 that holds the camera position. MPlayerObject->setCollisionShape(mPlayerBox) I'm setting them up like this: mPlayerBox = new btBoxShape(btVector3(1,3,1)) Right now I have player and enemy objects of the type btCollisionObject*. OverlappingPairCache, solver, collisionConfig) ĭynamicsWorld->setGravity(btVector3(0.0f, -9.8f, 0.0f)) Solver = new btSequentialImpulseConstraintSolver ĭynamicsWorld = new btDiscreteDynamicsWorld(dispatcher, OverlappingPairCache = new btDbvtBroadphase() Here's my world setup function: collisionConfig = new btDefaultCollisionConfiguration() ĭispatcher = new btCollisionDispatcher(collisionConfig) I'll try to keep this as brief as I can without leaving anything important out. Everything runs fine without crashes or apparent memory leaks, but I get no collisions so I must be making some mistakes somewhere. To get the simplest example going, I'm trying to find collisions between objects with btBoxShape as their shape. I just want to update object locations every frame and use it to tell me when I have collisions. I don't need it to move any objects for me or handle rendering with callbacks. I'm trying to use Bullet Physics for collision detection only.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |