box2D: B2RayCastCallback class missing


Hello again.
As the title suggests, B2RayCastCallback class is missing from
I’m following this tutorial:
and at one point they want me to extend b2RayCastCallback which doesn’t exist.
If anyone experienced with box2d could help me out on how to work around this problem, that would be fantastic.



I think we’re using a Haxe function type for the callback, here:

so you could try passing a function like:

function rayCastCallback (fixture:B2Fixture, point:B2Vec2, normal:B2Vec2, fraction:Float):Void {

function rayCastCallback (fixture:B2Fixture, point:B2Vec2, normal:B2Vec2, fraction:Float):Float{

Thanks, just needed to replace the return value from Void to Float.


Oh, yeah! Dynamic, not Void. I wonder if it always returns a Float, or if it ever returns something else?


From all the tutorials I’ve read on this subject it seems like this function should return Float.
and on page 60 of the official manual for box2D:
And I think if you return some other class, it will be registered as returning 1, which is the best option for the function to work properly.

Again, thanks a lot of the help.