Physics Simulation Forum


All times are UTC

Post new topic Reply to topic  [ 2 posts ] 
Author Message
PostPosted: Fri Jun 16, 2017 10:46 pm 

Joined: Fri Jun 16, 2017 2:20 pm
Posts: 5

I am unable to get working collisions using btGImpactShape. Maybe I doing the construction incorrectly. debugDrawer does not draw any shapes and there are no collisions (when there should be!).

Here is my code :
btTriangleMesh *mTriMesh = new btTriangleMesh(true, false);

   for (int i = 0; i < m_Entries[0].vertices.size()/3; i++) {
      btVector3 v1(m_Entries[0].vertices[i].x, m_Entries[0].vertices[i].y, m_Entries[0].vertices[i].z);
      btVector3 v2(m_Entries[0].vertices[i+1].x, m_Entries[0].vertices[i+1].y, m_Entries[0].vertices[i+1].z);
      btVector3 v3(m_Entries[0].vertices[i+2].x, m_Entries[0].vertices[i+2].y, m_Entries[0].vertices[i+2].z);
      mTriMesh->addTriangle(v1, v2, v3, true);

   btGImpactMeshShape *groundCollisionShape = new btGImpactMeshShape(mTriMesh);
   int i = groundCollisionShape->getMeshPartCount();

   /* shape test 2 END */
   //btCollisionShape* boxCollisionShape = new btBoxShape(btVector3(1.0f, 1.0f, 1.0f)); // TEST
   btRigidBody::btRigidBodyConstructionInfo rigidBodyCI(mass,              // mass, in kg. 0 -> Static object, will never move.
      localInertia);     // local inertia
   rigidBody = new btRigidBody(rigidBodyCI);
   //dynamicsWorld->getDispatchInfo().m_enableSatConvex = true;
   rigidBody->setGravity(btVector3(0.0f, 0.0f, 0.0f));

Please help. I am working towards a University deadline and collisions do not work...



PostPosted: Mon Jun 19, 2017 2:12 pm 

Joined: Fri Apr 29, 2016 2:41 pm
Posts: 41
Please make sure you actually register the GImpact collision algorithm.

btCollisionDispatcher *dispatcher = static_cast<btCollisionDispatcher *>(m_pDynamicsWorld->getDispatcher());

Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC

Who is online

Users browsing this forum: Baidu [Spider], Bing [Bot], Google [Bot] and 15 guests

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group