Physics Simulation Forum

 

All times are UTC




Post new topic Reply to topic  [ 1 post ] 
Author Message
PostPosted: Fri Jun 16, 2017 10:44 pm 
Offline

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

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 :
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);
   groundCollisionShape->setMargin(0.05);
   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.
      motionstate,
      groundCollisionShape,
      localInertia);     // local inertia
   rigidBody = new btRigidBody(rigidBodyCI);
   rigidBody->activate(true);
   dynamicsWorld->addRigidBody(rigidBody);
   //dynamicsWorld->getDispatchInfo().m_enableSatConvex = true;
   rigidBody->setUserPointer((void*)this);
   rigidBody->setGravity(btVector3(0.0f, 0.0f, 0.0f));


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

Thanks

Rupert


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC


Who is online

Users browsing this forum: Baidu [Spider], Exabot [Bot], Yahoo [Bot] and 17 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