Physics Simulation Forum

 

All times are UTC




Post new topic Reply to topic  [ 4 posts ] 
Author Message
PostPosted: Fri Jun 16, 2017 2:28 pm 
Offline

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

I am experiencing a problem that colliding with certain btConvexHullShapes does not trigger a contact.
The famous suzanne and teapot objects work when using below method. When using a plane with a hole inside it does not work. If that cannot work please let me know. What I want to achieve is flying a spaceship through a hole in a plane and detecting whether it has collided with the edges of the hole in the plane.

Thanks!

Rupert

I am using the following code:

Code:
btConvexHullShape* shape = new btConvexHullShape();
   //btVector3 v;
   for (int i = 0; i < m_Entries[0].vertices.size(); i++) {
      btVector3 v(m_Entries[0].vertices[i].x, m_Entries[0].vertices[i].y, m_Entries[0].vertices[i].z);
      shape->addPoint(v);
   }

   shape->optimizeConvexHull();
   shape->initializePolyhedralFeatures();


Top
 Profile  
 
PostPosted: Fri Jun 16, 2017 4:44 pm 
Offline
User avatar

Joined: Tue Sep 30, 2014 6:03 pm
Posts: 346
Location: San Francisco
You are using a btConvexHullShape which creates a convex hull around the points that you give it. You can feed a teapot to a convex hull but the result won't collide quite like what the teapot looks like. Search for "teapot convex hull" on images.google.com and you'll see some example images of what is going on.

Once you understand what a "convex hull" is, it should be clear why you can't use btConvexHullShape for a plane with a hole inside. You need to use a different shape type, maybe btBvhTriangleMeshShape or you could break the plane+hole into pieces and use btCompoundShape around several btConvexHullShapes.


Top
 Profile  
 
PostPosted: Fri Jun 16, 2017 8:26 pm 
Offline

Joined: Fri Jun 16, 2017 2:20 pm
Posts: 5
Thank you so much. It looks fine in debugdrawer.

Does it still not work if I am using shape->initializePolyhedralFeatures(); ?

Which approach would you recommend as alternative in terms of speed/ease of use ? btBvhTriangleMeshShape or btCompoundShape ?

Thanks

Greetings, Rupert


Top
 Profile  
 
PostPosted: Sat Jun 17, 2017 1:11 am 
Offline
User avatar

Joined: Tue Sep 30, 2014 6:03 pm
Posts: 346
Location: San Francisco
The btBvhTriangleMeshShape works surprisingly well in my experience. However, a body that uses such a shape MUST be static (it can't be dynamic or kinematic). Also, that shape works ok if the mesh doesn't have a high triangle density. That is, a small object with all 10k triangles packed into a small space would be a problem, but 10k triangles spread out over a whole terrain might be ok... where "small" means "small relative to the things that are colliding against it".

If the object must be dynamic I recommend building a btCompoundShape however if you're on a tight time budget I'd say avoid that complexity if possible... unless you are good at 3DStudioMax or Blender and know how to convexify the geometry using those tools.


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

All times are UTC


Who is online

Users browsing this forum: Baidu [Spider], Bing [Bot], Google [Bot] and 14 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