I've attached the code to the issue, but don't really know how to make the patch.
Regards,
Ales
New btInternalEdgeUtility has been added
-
- Posts: 35
- Joined: Mon Dec 27, 2010 10:46 pm
Re: New btInternalEdgeUtility has been added
I implemented the code from Erwin's first post, along with a "gContactAddedCallback = CustomMaterialCombinerCallback;" somewhere in the code (otherwise nothing change) and the bumby triangle plane problem looks solved with most shapes (spheres, cubes and capsules so far).
Unfortunately, I'm experiencing immediate crashes once a btGImpactMeshShape collide with the corrected btBvhTriangleMeshShape.
Has anybody experienced this problem ?
Does anybody have any clue on what could solve it ?
I'd hate to have to use 2 differents worlds and layer them depending on what I simulate.
....but maybe it's the way to go idk.
Unfortunately, I'm experiencing immediate crashes once a btGImpactMeshShape collide with the corrected btBvhTriangleMeshShape.
Has anybody experienced this problem ?
Does anybody have any clue on what could solve it ?
I'd hate to have to use 2 differents worlds and layer them depending on what I simulate.
....but maybe it's the way to go idk.
-
- Posts: 65
- Joined: Fri May 13, 2011 1:11 pm
Re: New btInternalEdgeUtility has been added
Hey,
I've got the internal edge tool working (albeit it is still throwing out a lot of "normals not identical").
And I was wondering if the tool can be applied to a Compound shape of BvHTriangleMeshes.
I've tried sparks old code from page 3 in this thread, but it won't work.
It required a small adjustment:
However, because partId0 and index0 are taken from the collision object with the compound shape as a root, they are zeros.
Which means that
will block the actual internal edge fixing.
How do I make sure each bvhtrianglemesh within a compound has its edges fixed?
Cheers.
edit::
the "normals not identical" was comparing -0,-0,1 normals to 0,000001313, 0,00000123131 , 0,99999131321 normals (or similar) and deemed them not equal, is the test condition too strict, or was this intentional? These normals are practically equal. Or does this not impact the actual calculations?
I've got the internal edge tool working (albeit it is still throwing out a lot of "normals not identical").
And I was wondering if the tool can be applied to a Compound shape of BvHTriangleMeshes.
I've tried sparks old code from page 3 in this thread, but it won't work.
It required a small adjustment:
Code: Select all
if (colObj0->getCollisionShape()->getShapeType() != TRIANGLE_SHAPE_PROXYTYPE)
return;
btBvhTriangleMeshShape* trimesh = 0;
if( colObj0->getRootCollisionShape()->getShapeType() == SCALED_TRIANGLE_MESH_SHAPE_PROXYTYPE )
trimesh = ((btScaledBvhTriangleMeshShape*)colObj0->getRootCollisionShape())->getChildShape();
else
trimesh = (btBvhTriangleMeshShape*)colObj0->getRootCollisionShape();
const btCollisionShape *root = colObj0->getRootCollisionShape();
if ( trimesh->getShapeType() == COMPOUND_SHAPE_PROXYTYPE)
{
const btCompoundShape *compound = (const btCompoundShape*) root;
// hunt for a trimesh in the compound
int found = 0;
for (int i=0 ; i<compound->getNumChildShapes() ; ++i)
{
const btCollisionShape *s = compound->getChildShape(i);
if (s->getShapeType() == TRIANGLE_MESH_SHAPE_PROXYTYPE)
{
found++;
root = s;
}
}
if (found > 0)
{
trimesh = (btBvhTriangleMeshShape*)root;
}
}
// assert(root->getShapeType() == TRIANGLE_MESH_SHAPE_PROXYTYPE);
btTriangleInfoMap* triangleInfoMapPtr = (btTriangleInfoMap*) trimesh->getTriangleInfoMap();
Which means that
Code: Select all
btTriangleInfo* info = triangleInfoMapPtr->find(hash);
if (!info)
return;
How do I make sure each bvhtrianglemesh within a compound has its edges fixed?
Cheers.
edit::
the "normals not identical" was comparing -0,-0,1 normals to 0,000001313, 0,00000123131 , 0,99999131321 normals (or similar) and deemed them not equal, is the test condition too strict, or was this intentional? These normals are practically equal. Or does this not impact the actual calculations?