I am having an issue with convexSweepTest(). Testing a box shape against a world containing bvhTriangleMeshShapes.
I have diagnosed it down to the following case being the problem:
If a triangle in the mesh is large enough that the box object being swept can be in contact with the triangle but not be touching any of the triangle edges during the sweep and the sweep direction is parallel (or very near parallel) to the triangle's plane, then bullet will not report a hit in that triangle.
If I change the sweep direction such that it's no longer parallel to the plane of the triangle, then bullet will report the hit.
Below (attached also) is my handy dandy programmer art drawing of what I am describing. In my case the length of the sweep is about 2 meters, and the triangle is just big enough (like 3m sides). Also, pretend the circles are boxes.
Issue with convexSweepTest() not reporting hits
-
- Posts: 66
- Joined: Fri Oct 12, 2007 6:28 pm
- Location: San Diego
Issue with convexSweepTest() not reporting hits
You do not have the required permissions to view the files attached to this post.
-
- Site Admin
- Posts: 4221
- Joined: Sun Jun 26, 2005 6:43 pm
- Location: California, USA
Re: Issue with convexSweepTest() not reporting hits
Could it be that the starting point is already in penetration? Right now the convexSweepTest doesn't report any hit if the starting point is in penetration.
Thanks,
Erwin
Thanks,
Erwin
-
- Posts: 66
- Joined: Fri Oct 12, 2007 6:28 pm
- Location: San Diego
Re: Issue with convexSweepTest() not reporting hits
Yes, the starting point is in penetration.
Can I make it report these cases somehow?
Can I make it report these cases somehow?
-
- Site Admin
- Posts: 4221
- Joined: Sun Jun 26, 2005 6:43 pm
- Location: California, USA
Re: Issue with convexSweepTest() not reporting hits
The best you can get is a fallback to the discrete collision detector, providing a contact normal, distance and time of impact of zero, is that ok?reltham wrote:Yes, the starting point is in penetration.
Can I make it report these cases somehow?
We will improve the query for Bullet 2.76.
Cheers!
Erwin
-
- Posts: 66
- Joined: Fri Oct 12, 2007 6:28 pm
- Location: San Diego
Re: Issue with convexSweepTest() not reporting hits
That would be great. In our current usage case, even if it just reported that it started in collision with an object that would be enough.
Is this something you need to add or is there something I can do to make it happen? I spent a little time digging through the bullet code related to the convex sweeps and wasn't able to figure out where it "ignores" the starting in penetration case. I assume it's someplace down in the bowels of the gjk or whatever.
On a similar note, it would be handy if there were queries that could take a shape and return all of the objects (filtered like any other collision checks) in the collision world that are in contact with the shape or contained by the shape. I understand that you have ghost objects, but those don't really work well for this, since you have to create one and insert it into the world and then go thru some update cycles before you can find out what's in contact. I want to be able to just make a single call similar to rayTest or convexSweepTest that just returns the results.
Thanks,
Roy
Is this something you need to add or is there something I can do to make it happen? I spent a little time digging through the bullet code related to the convex sweeps and wasn't able to figure out where it "ignores" the starting in penetration case. I assume it's someplace down in the bowels of the gjk or whatever.
On a similar note, it would be handy if there were queries that could take a shape and return all of the objects (filtered like any other collision checks) in the collision world that are in contact with the shape or contained by the shape. I understand that you have ghost objects, but those don't really work well for this, since you have to create one and insert it into the world and then go thru some update cycles before you can find out what's in contact. I want to be able to just make a single call similar to rayTest or convexSweepTest that just returns the results.
Thanks,
Roy
-
- Site Admin
- Posts: 4221
- Joined: Sun Jun 26, 2005 6:43 pm
- Location: California, USA
Re: Issue with convexSweepTest() not reporting hits
It all happens inside this file. The discrete collision detection is called (using GJK), and the normal and contact point is store (but no distance):
http://code.google.com/p/bullet/source/ ... lision.cpp
An easy to use API query will be added for discrete collision detection, with a first beta release of 2.76 later this month. Using a ghost shape should be fine too, there should be no need for update cycles.
http://code.google.com/p/bullet/source/ ... lision.cpp
An easy to use API query will be added for discrete collision detection, with a first beta release of 2.76 later this month. Using a ghost shape should be fine too, there should be no need for update cycles.
-
- Posts: 66
- Joined: Fri Oct 12, 2007 6:28 pm
- Location: San Diego
Re: Issue with convexSweepTest() not reporting hits
So I commented out a check near the bottom and calcTimeOfImpact() in that file.
Commenting out this made my sweeps work the way I wanted them to, and it didn't seem to have any ill effects on our other collision/dynamics stuff, so I can get by with this change until your changes come along in 2.76.
I also found that the allowedPenetration that I was passing into convexSweepTest() was not making it into here. That result.m_allowedPenetration was always 0. I tried 1, 10, and 1000 going into convexSweepTest() and it seemed to make no difference. Perhaps this has to do with the objects in the world (that I am doing sweeps against) being bvhTriangleMeshShapes?
Code: Select all
if ((projectedLinearVelocity+ maxAngularProjectedVelocity)<=result.m_allowedPenetration)//SIMD_EPSILON)
return false;
I also found that the allowedPenetration that I was passing into convexSweepTest() was not making it into here. That result.m_allowedPenetration was always 0. I tried 1, 10, and 1000 going into convexSweepTest() and it seemed to make no difference. Perhaps this has to do with the objects in the world (that I am doing sweeps against) being bvhTriangleMeshShapes?
-
- Posts: 169
- Joined: Sun Jan 14, 2007 7:56 pm
- Location: Norway
Re: Issue with convexSweepTest() not reporting hits
Hi,Erwin Coumans wrote: An easy to use API query will be added for discrete collision detection, with a first beta release of 2.76 later this month. Using a ghost shape should be fine too, there should be no need for update cycles.
just wondered if this particular feature has been added yet? I need to do some "probing around" using a collision shape.
Cheers,
Ola
-
- Site Admin
- Posts: 4221
- Joined: Sun Jun 26, 2005 6:43 pm
- Location: California, USA
Re: Issue with convexSweepTest() not reporting hits
* EDIT: a fix for the contactTest has been added in revision 1987 *
The user should derive its own class from ContactResultCallback and implement
the following callback (similar to the gContactAddedCallback):
I haven't tested the contactTest query yet, can you try it out?
The queryColObj doesn't need to be inserted in the world. In fact, if you only have a collision shape and world transform, you can use this:
There is also a pairwise test (contactPairTest). Can you test the new queries and let us know if it works for you?
Thanks!
Erwin
By the way: queries between certain concave shapes are not supported (btBvhTriangleMeshShape versus btBvhTriangleMeshShape or btStaticPlaneShape etc.)
OK, the latest trunk has a new discrete collision query against all overlapping objects in the world:ola wrote:just wondered if this particular feature has been added yet? I need to do some "probing around" using a collision shape.
Code: Select all
void btCollisionWorld::contactTest(btCollisionObject* queryColObj,ContactResultCallback& resultCallback);
the following callback (similar to the gContactAddedCallback):
Code: Select all
virtual btScalar addSingleResult(btManifoldPoint& cp, const btCollisionObject* colObj0,int partId0,int index0,const btCollisionObject* colObj1,int partId1,int index1) = 0;
The queryColObj doesn't need to be inserted in the world. In fact, if you only have a collision shape and world transform, you can use this:
Code: Select all
btCollisionObject tmpObj;
tmpObj.setCollisionShape(shape);
tmpObj.setWorldTransform(worldTrans);
world->contactTest(tempObj,callack);
Thanks!
Erwin
By the way: queries between certain concave shapes are not supported (btBvhTriangleMeshShape versus btBvhTriangleMeshShape or btStaticPlaneShape etc.)