behdad / box2d

Automatically exported from code.google.com/p/box2d
2 stars 12 forks source link

Difficult to filter while raycasting. #72

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
For details:
http://www.box2d.org/forum/viewtopic.php?f=3&t=4343&view=unread#unread

Essentially, the following callback is broken, despite looking ostensibly ok:
class MyCallback : b2RayCastCallback
{
public:
b2Fixture* best;
bool MyCriteria(b2Fixture*);
virtual ~b2RayCastCallback() {}
virtual float32 ReportFixture(   b2Fixture* fixture, const b2Vec2& point,
                           const b2Vec2& normal, float32 fraction){
if(!MyCriteria(fixture))
  return 1;
best = fixture;
return fraction;
}
};

Original issue reported on code.google.com by sadwanm...@gmail.com on 29 Jan 2010 at 9:39

GoogleCodeExporter commented 9 years ago
Now you can return -1 from a ray-cast to filter the result.

Original comment by erinca...@gmail.com on 7 Mar 2010 at 9:51