takahiyn / bullet

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

btSoftBodyHelpers::CreateFromTriMesh() randomizes the faces before the application can store custom data #315

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
btSoftBodyHelpers::CreateFromTriMesh() calls
btSoftBody::randomizeConstraints() before returning the new soft body. It
doesn't give a chance to the application to store custom data in the
Element::m_tag fields of the faces before they are randomized.

I use Element::m_tag to store information about the original graphic
object: UV mapping, mesh polygon, etc.

It's preferable to not call btSoftBody::randomizeConstraints() in
btSoftBodyHelpers::CreateFromTriMesh() and let the application call it
after eventually setting data in m_tag.

Applicable to Bullet 2.74 and 2.75

Suggested patch:

Index: src/BulletSoftBody/btSoftBodyHelpers.cpp
===================================================================
--- src/BulletSoftBody/btSoftBodyHelpers.cpp    (revision 24972)
+++ src/BulletSoftBody/btSoftBodyHelpers.cpp    (working copy)
@@ -828,7 +828,8 @@
 #undef IDX
        psb->appendFace(idx[0],idx[1],idx[2]);
    }
-   psb->randomizeConstraints();
+   // don't randomize now, let's give a chance to the application to set
custom face data 
+   //psb->randomizeConstraints();
    return(psb);
 }

Original issue reported on code.google.com by benoitbo...@gmail.com on 4 Dec 2009 at 10:33

GoogleCodeExporter commented 9 years ago

That makes sense, thanks for the feedback, we'll look into it.

Original comment by erwin.coumans on 8 Dec 2009 at 9:05

GoogleCodeExporter commented 9 years ago

I added an option argument 'randomizeConstraints' that defaults to true, to 
avoid 
changes in API/behaviour changes.
Commit is here:
http://code.google.com/p/bullet/source/detail?r=1842

Please add a last argument as false, and call 'psb->randomizeConstraints() 
manually.

Original comment by erwin.coumans on 13 Dec 2009 at 8:37