Get collisions for btPairCachingGhostObject
Posted: Sun Jun 04, 2017 8:20 pm
Greetings!
I'm struggling to extract pairCachingGhostObject's collision pairs. I'm following what is said in btGhostObject section of this wiki article, however manifold->getNumContacts() is always returning zero. I've tried to use code from demos and code used in btKinematicCharacterController's method "recoverFromPenetration", but with no success as well - manifold again returns count of zero contacts in both cases. Except from that, the rest of physics world is working fine.
Here's how I initialize the ghost object and character controller:
I believe I've made some silly mistake, but I can't figure it out. I'd really appreciate your help, guys.
I'm struggling to extract pairCachingGhostObject's collision pairs. I'm following what is said in btGhostObject section of this wiki article, however manifold->getNumContacts() is always returning zero. I've tried to use code from demos and code used in btKinematicCharacterController's method "recoverFromPenetration", but with no success as well - manifold again returns count of zero contacts in both cases. Except from that, the rest of physics world is working fine.
Here's how I initialize the ghost object and character controller:
Code: Select all
this->collisionObject = this->ghost = new MotionStatePairCachingGhostObject(this->motionState); // This class is inheriting regular btPairCachingGhostObject and extends it with motion state functionality (the only modification is to call motionState's setWorldTransform method)
this->ghost->setCollisionShape(this->physics.getEmptyShape()); // This is later assigned to regular collision shape
this->ghost->setRestitution(0.0f);
this->ghost->setUserPointer(this);
this->ghost->setFriction(1.2f);
this->ghost->setCollisionFlags(btCollisionObject::CF_CHARACTER_OBJECT);
this->controller = new btKinematicCharacterController(this->ghost, this->collisionShape, 0.2f, fromVec3(glm::vec3(0.0f, 1.0f, 0.0f)));
this->physics.getDynamicsWorld()->addCollisionObject(this->ghost, btBroadphaseProxy::CharacterFilter, btBroadphaseProxy::StaticFilter | btBroadphaseProxy::DefaultFilter);
this->physics.getDynamicsWorld()->addCharacter(this->controller);