Problems with OgreBullet collision detection

akvlad

12-09-2012 21:33:23

I'm writing augmented reality applications with ogre3d graphics engine.
When I began to process collision detection of manipulator and objects, there are some problems there. Everything is correctly compiled, but collisions are not being processed.
Here is the code of the function.

/* Creating objects:
//... Cone
OgreBulletCollisions::ConeCollisionShape *ManipulatorConeShape=new
OgreBulletCollisions::ConeCollisionShape(Ogre::Real(0.005),Ogre::Real(0.02),Ogre::Vector3(0,1,0));
OgreBulletDynamics::RigidBody* defaultBody=new OgreBulletDynamics::RigidBody("ManipulatorConeRigid",
owner->mWorld);
Ogre::Vector3 pos_vec=Manipulator_Cone_Node->getPosition();
Ogre::Quaternion orient_quat=Manipulator_Cone_Node->getOrientation();
defaultBody->setShape(Manipulator_Cone_Node,ManipulatorConeShape,0.6,0.6,1.0,pos_vec,
orient_quat);
//... And box
OgreBulletCollisions::BoxCollisionShape* boxColShape=new OgreBulletCollisions::BoxCollisionShape
(Ogre::Vector3 (0.03,0.03,0.03));
OgreBulletDynamics::RigidBody* boxRigBody=new OgreBulletDynamics::RigidBody("OgreAppBoxRigid",
Params->mWorld);
Ogre::Vector3 pos_vec=boxNode->getPosition();
Ogre::Quaternion orient_quat=boxNode->getOrientation();
boxRigBody->setShape(boxNode,boxColShape,0,0,0,pos_vec,orient_quat);
// Function of collision processing
void processCollisions(OgreARAppLogic* owner)
{
btCollisionWorld* btWrld=((OgreBulletCollisions::CollisionsWorld*) owner->mWorld)->getBulletCollisionWorld();
int numManifolds = btWrld->getDispatcher()->getNumManifolds();
for (int i=0;i<numManifolds;i++)
{
cout<<"Yeeah collision\n";
}
}

DebugDrawer draws containers correctly but when cone intersects cube numManifolds is still 0. I move objects by commands SceneNode::setPosition(...) and SceneNode::setOrientation(...). Is there some special methods to move shapes or something that I missed? Or some other suggestions about this problem? Thank you.