Hi, I like to be able to have raytest that does not hit backface polygon. Unfortunately the triangle testing part can't be overriden. So the only way is to change the source.
I hope this request is sane.
raytest: disable backface hit
-
- Posts: 508
- Joined: Fri May 30, 2008 2:51 am
- Location: Ossining, New York
Re: raytest: disable backface hit
Can't you just use the nearest "hit", i.e. filter the results yourself.
-
- Posts: 11
- Joined: Tue Mar 11, 2008 4:14 am
Re: raytest: disable backface hit
That would be rather slow. I would have to get back the triangle info, regenerate the normal, then do the checking. If it's done inside btTriangleRaycastCallback::processTriangle() it would be pretty much more efficient.
-
- Posts: 508
- Joined: Fri May 30, 2008 2:51 am
- Location: Ossining, New York
Re: raytest: disable backface hit
You get back the distance along the ray so you can just use that
-
- Posts: 11
- Joined: Tue Mar 11, 2008 4:14 am
Re: raytest: disable backface hit
Umm.. what can distance tell me? It doesn't even tell me the triangle normal the ray is intersecting. Maybe you didn't quite understood me. What I want is to have a rayTest that ignores backfacing triangles; mainly static mesh shapes (btBvhTriangleMeshShape).
I still think it is better if bullet support it.
I still think it is better if bullet support it.
-
- Posts: 141
- Joined: Mon Jul 02, 2007 5:12 pm
Re: raytest: disable backface hit
I think the answer here is to override whichever classes you need and add the functionality to Bullet in your new class(es). btTriangleRaycastCallback seems like where you want to start, from what you say. One of the main strengths of Bullet, and most open source projects in my opinion, is the ability for special case solutions, or ones that just haven't been implemented yet, to be done by anyone. Have at it
- Alex
- Alex
-
- Posts: 11
- Joined: Tue Mar 11, 2008 4:14 am
Re: raytest: disable backface hit
Yes, that would be right in most cases. Unfortunately, btCollisionWorld::rayTestSingle() is not overridable. It's a static function.
It seemed nobody seem to have cared for such feature. I guess I'll just hack in something and submit a patch.
Most likely add a m_ignoreBackface option in btCollisionWorld::RayResultCallback.
It seemed nobody seem to have cared for such feature. I guess I'll just hack in something and submit a patch.
Most likely add a m_ignoreBackface option in btCollisionWorld::RayResultCallback.
-
- Posts: 34
- Joined: Tue Mar 04, 2008 3:16 pm
Re: raytest: disable backface hit
And, did you succeed? I need an option like this, too ...
-
- Posts: 11
- Joined: Tue Mar 11, 2008 4:14 am
Re: raytest: disable backface hit
Yes, infact it's very easy to implement. However eventually I decided I don't need it anymore so I didn't really bothered with it.
If you want it, you can hack it in by opening btRaycastCallback.cpp:
Look for btTriangleRaycastCallback::processTriangle()
then change:
to
Maybe you can propose a way to set it as an option with it disabled by default. Would be cool to have it in the official build.
If you want it, you can hack it in by opening btRaycastCallback.cpp:
Look for btTriangleRaycastCallback::processTriangle()
then change:
Code: Select all
if ( dist_a * dist_b >= btScalar(0.0) )
{
return ; // same sign
}
Code: Select all
if ( dist_a * dist_b >= btScalar(0.0) || dist_b > dist_a)
{
return ; // same sign
}