"pure virtual method called
This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information."
I'm working with positive gravity because for reasons I haven't yet looked into, my world is upside down :S
Heres my init code:
Code: Select all
void Scene::physicsInit()
{
maxRigidBodies = 1024; //maybe this should be in the scene file instead
btVector3 worldAabbMin(-10000, -10000, -10000); //world size for broadphase.
btVector3 worldAabbMax(10000, 10000, 10000); //should probs be loaded from scene file to
broadphase = new btAxisSweep3(worldAabbMin, worldAabbMax, (unsigned short)maxRigidBodies);
//m_overlappingPairCache = broadphase;
collisionConfig = new btDefaultCollisionConfiguration();
dispatcher = new btCollisionDispatcher(collisionConfig);
solver = new btSequentialImpulseConstraintSolver;
dynamicsWorld = new btDiscreteDynamicsWorld(dispatcher, broadphase, solver, collisionConfig);
dynamicsWorld->setGravity(btVector3(0.0f, 1.0f, 0.0f));
}
Code: Select all
void Scene::addTestCol()
{
btCollisionShape* fallShape = new btSphereShape(1);
btDefaultMotionState* fallMotionState =
new btDefaultMotionState(btTransform(btQuaternion(0,0,0,1),btVector3(0,-100,0)));
btScalar mass = 0.11;
btVector3 fallInertia(0,0,0);
fallShape->calculateLocalInertia(mass,fallInertia);
btRigidBody::btRigidBodyConstructionInfo fallRigidBodyCI(mass,fallMotionState,fallShape,fallInertia);
fallRigidBody = new btRigidBody(fallRigidBodyCI);
dynamicsWorld->addRigidBody(fallRigidBody);
}
Code: Select all
cnVertex Scene::getTestPos()
{ std::cout << "Activation state: " << fallRigidBody->isInWorld() << std::endl;
btTransform trans;
fallRigidBody->getMotionState()->getWorldTransform(trans);
std::cout << "sphere height: " << trans.getOrigin().getY() << std::endl;
cnVertex temp;
temp.x = trans.getOrigin().getX();
temp.y = trans.getOrigin().getY();
temp.z = trans.getOrigin().getZ();
return temp;
}