|
Hi,
We recently working on a 3d game and we integrated bullet physics for our collision detection purpose & basic physics. I used a btCapsuleShapeZ collider for my playable character and for mesh I used btBvhTriangleMeshShape.
Collision is working great... thanks to bullet community. But recently we found a problem like the collider is colliding on both sides of a triangle (front and back). How can I make it to collide only on front side. Is there any flag i need to set ?.
Bellow mentioned is our create collision mesh function.
void physicsEngine::createCollisionMesh(gxColMesh* colMesh) { btTriangleIndexVertexArray* indexVertexArray = new btTriangleIndexVertexArray(colMesh->m_nTris, colMesh->m_psziGLTriLst, 3*sizeof(int), colMesh->m_nVerts, (float*)colMesh->m_psziGLVertexLst, 3*sizeof(float)); m_pszIndexVertexArrayList.push_back(indexVertexArray); btBvhTriangleMeshShape* trimeshShape = new btBvhTriangleMeshShape(indexVertexArray, true, m_cAABBMin, m_cAABBMax); m_pszCollisionShapes.push_back(trimeshShape);
/// Create Dynamic Objects btTransform startTransform; startTransform.setIdentity(); btVector3 localInertia(0,0,0); startTransform.setOrigin(btVector3(0, 0, 0));
//using motionstate is recommended, it provides interpolation capabilities, and only synchronizes 'active' objects btDefaultMotionState* myMotionState = new btDefaultMotionState(startTransform); btRigidBody::btRigidBodyConstructionInfo rbInfo(0,myMotionState,trimeshShape,localInertia); btRigidBody* body = new btRigidBody(rbInfo); body->setCollisionFlags(body->getCollisionFlags() | btCollisionObject::CF_KINEMATIC_OBJECT);//STATIC_OBJECT); //enable custom material callback body->setCollisionFlags(body->getCollisionFlags() | btCollisionObject::CF_CUSTOM_MATERIAL_CALLBACK); m_pDynamicsWorld->addRigidBody(body); }
Please help....
thanks in advance. arun
|