I am currently able to make a ray cast in box2d and make it locate the closest object. I can also get the intersection point of the ray and the body. I need to find where the ray leaves the body. Does anyone know? This has been puzzling me for a few days and any help at all would be much appreciated. Here is my ray cast callback...
#import "Box2D.h"
class RaysCastCallback : public b2RayCastCallback
{
public:
RaysCastCallback() : m_fixture(NULL) {
}
float32 ReportFixture(b2Fixture* fixture, const b2Vec2& point, const b2Vec2& normal, float32 fraction) {
m_fixture = fixture;
m_point = point;
m_normal = normal;
m_fraction = fraction;
return fraction;
}
b2Fixture* m_fixture;
b2Vec2 m_point;
b2Vec2 m_normal;
float32 m_fraction;
};