Beispiel #1
0
//-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~
PhysicsZone::pCollisionShape_type
PhysicsZone::createCapsuleShape(float _radius, float _height)
{
    CollisionShape* pRawPointer = new CollisionShape();
    pCollisionShape_type pShape(pRawPointer, boost::bind(&PhysicsZone::destroyCollisionShape, this, _1));

    pRawPointer->setShapePtr(new btCapsuleShape(_radius, _height));
    // TODO - set offsetMatrix (currently passing NULL, which centers the body at its origin)
    return pShape;
}
Beispiel #2
0
//-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~
PhysicsZone::pCollisionShape_type
PhysicsZone::createBoxShape(float _dx, float _dy, float _dz)
{
    CollisionShape* pRawPointer = new CollisionShape();
    pCollisionShape_type pShape(pRawPointer, boost::bind(&PhysicsZone::destroyCollisionShape, this, _1));

    pRawPointer->setShapePtr(new btBoxShape(btVector3(_dx,_dy,_dz)));
    // TODO - set offsetMatrix (currently passing NULL, which centers the body at its origin)
    return pShape;
}
Beispiel #3
0
//-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~
PhysicsZone::pCollisionShape_type
PhysicsZone::createOvoidShape(float _radiusX, float _radiusY, float _radiusZ)
{
    CollisionShape* pRawPointer = new CollisionShape();
    pCollisionShape_type pShape(pRawPointer, boost::bind(&PhysicsZone::destroyCollisionShape, this, _1));

    //seem to recall something about a multisphere shape being scalable in multiple directions... research further
    pRawPointer->setShapePtr(new btSphereShape(btScalar(_radiusX)));
    // TODO - set offsetMatrix (currently passing NULL, which centers the body at its origin)
    return pShape;
}
Beispiel #4
0
//-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~
PhysicsZone::pCollisionShape_type
PhysicsZone::createNullShape()
{
    CollisionShape* pRawPointer = new CollisionShape();
    pCollisionShape_type pShape(pRawPointer, boost::bind(&PhysicsZone::destroyCollisionShape, this, _1));

    //bit of a hacktastic workaround, but see http://www.bulletphysics.org/Bullet/phpBB3/viewtopic.php?f=9&t=4461&hilit=btRigidBody+vs+btCollisionObject for intent
    pRawPointer->setShapePtr(new btSphereShape(btScalar(1.)));
    pRawPointer->setIsNUllShape(true);
    // TODO - set offsetMatrix (currently passing NULL, which centers the body at its origin)
    return pShape;
}