lucas95123 / bullet

Automatically exported from code.google.com/p/bullet
Other
0 stars 0 forks source link

[patch] btAdjustInternalEdgeContacts crashes if passed shape is not of expected type #673

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
btAdjustInternalEdgeContacts checks for "SCALED_TRIANGLE_MESH_SHAPE_PROXYTYPE" 
if that's not it, it will assume it can only be a valid btBvhTriangleMeshShape, 
which is wrong.

Consider the case when a trimesh shape is inside a compound shape for example.

colObj0Wrap should be recursively checked on it's m_parent to search for the 
valid trimesh.
Attached patch does this, and is tested to work on a compound shape.

Original issue reported on code.google.com by kam1k...@gmail.com on 23 Nov 2012 at 2:23

Attachments:

GoogleCodeExporter commented 8 years ago
I'm not sure if a TRIANGLE_SHAPE_PROXYTYPE's parent always has a 
TRIANGLE_MESH_SHAPE_PROXYTYPE shape, so I left the 
SCALED_TRIANGLE_MESH_SHAPE_PROXYTYPE check.

Also, if it is guaranteed that the triangle's direct parent is always the 
trimesh, we could remove the whole do..while loop and just assign trimesh to 
colObj0Wrap->m_parent->m_shape instead.

Original comment by kam1k...@gmail.com on 23 Nov 2012 at 2:32

GoogleCodeExporter commented 8 years ago
And I forgot to mention, the partId and index arguments should be removed since 
that info is available on the object wrapper.

Original comment by kam1k...@gmail.com on 23 Nov 2012 at 2:34

GoogleCodeExporter commented 8 years ago
See https://github.com/bulletphysics/bullet3/issues/111

Original comment by erwin.coumans on 30 Mar 2014 at 7:20