I have added a btPairCachingGhostObject to my world like so:
Code: Select all
// Initialize ghost objects at the vertex locations
sphere = std::unique_ptr<btSphereShape>(new btSphereShape(0.05));
btTransform xform;
xform.setOrigin(m_vertexPos);
//xform.setBasis(btMatrix3x3(btQuaternion(btVector3(0, 0, 1), 0.0)));
xform.setRotation(btQuaternion(0, 0, 0, 1));
m_ghostVertex = std::unique_ptr<btPairCachingGhostObject>(new btPairCachingGhostObject());
m_ghostVertex->setCollisionShape(sphere.get());
m_ghostVertex->setWorldTransform(xform);
m_ghostVertex->setUserPointer(object);
ContactLearningApp::GetInstance()->GetWorld()->addCollisionObject(m_ghostVertex.get(), btBroadphaseProxy::StaticFilter, btBroadphaseProxy::AllFilter^btBroadphaseProxy::StaticFilter);
The problem is that if I tried to get the world transform of the ghost object without modifying rotation, I get huge values in my transform matrix..
I get the wold transform like this:
Code: Select all
btScalar transform[16];
btTransform wt = m_ghostVertex->getWorldTransform();
wt.getOpenGLMatrix(transform);
glPushMatrix();
glMultMatrixf(transform);
glColor3f(0.0f, 0.0f, 1.0f);
DrawCircle(0.05f);
glPopMatrix();
I'm not quite sure what is going on. Please advise.
P.S Also, if I could get notified when the ghost object overlaps with a static object that would be a bonus too.