MStatus collisionShapeNode::compute( const MPlug& plug, MDataBlock& data )
{
    if(plug == oa_collisionShape) {
         computeOutputShape(plug, data);
    } else if(plug == ca_collisionShape) {
         computeCollisionShape(plug, data);
    } else  if(plug == ca_collisionShapeParam) {
         computeCollisionShapeParam(plug, data);
    } else {
        return MStatus::kUnknownParameter;
    }
    return MStatus::kSuccess;
}
void BulletCharacterObject::load(Mesh::MeshdataPtr mesh) {
    LocationInfo& locinfo = mParent->info(mID);

    Vector3f objPosition = mParent->currentPosition(mID);
    Quaternion objOrient = mParent->currentOrientation(mID);
    btTransform startTransform = btTransform(
        btQuaternion(objOrient.x,objOrient.y,objOrient.z,objOrient.w),
        btVector3(objPosition.x,objPosition.y,objPosition.z)
    );

    mGhostObject = new btPairCachingGhostObject();
    mGhostObject->setWorldTransform(startTransform);
    mParent->broadphase()->getOverlappingPairCache()->setInternalGhostPairCallback(new btGhostPairCallback());

    // Currently only support spheres, TODO(ewencp) we might want to support
    // capsules instead.
    mCollisionShape = computeCollisionShape(mID, mBBox, BULLET_OBJECT_TREATMENT_CHARACTER, Mesh::MeshdataPtr());
    mGhostObject->setCollisionShape(mCollisionShape);
    mGhostObject->setCollisionFlags(btCollisionObject::CF_CHARACTER_OBJECT);

    // TODO(ewencp) make this configurable?
    btScalar stepHeight = btScalar(0.5);
    // FIXME(ewencp) we know we're only allocating spheres/capsules for this, so
    // it's currently safe to do this cast, but technically
    // computeCollisionShape can compute concave shapes as well.
    mCharacter = new BulletCharacterController (mGhostObject, static_cast<btConvexShape*>(mCollisionShape), stepHeight);


    // Get mask information
    bulletObjCollisionMaskGroup mygroup, collide_with;
    BulletObject::getCollisionMask(BULLET_OBJECT_TREATMENT_CHARACTER, &mygroup, &collide_with);
    mParent->dynamicsWorld()->addCollisionObject(mGhostObject, (short)mygroup, (short)collide_with);
    mParent->dynamicsWorld()->addAction(mCharacter);

    mParent->addTickObject(mID);
    mParent->addDeactivateableObject(mID);
}
void BulletRigidBodyObject::load(MeshdataPtr retrievedMesh) {
    mObjShape = computeCollisionShape(mID, mBBox, mTreatment, retrievedMesh);
    assert(mObjShape != NULL);
    addRigidBody();
}