You probably came here from my post on Stack Overflow, but if not, here is the thread: http://stackoverflow.com/questions/24834797/simple-general-raycasting-in-box2d-javascript-example ---------------------------------------------------------------------------------------------- Problem 1: Raycast callback itself was being called instead its ReportFixture function. In b2World.prototype.RayCast Before: return callback(fixture, point, output.normal, fraction); After: return callback.ReportFixture(fixture, point, output.normal, fraction); ---------------------------------------------------------------------------------------------- Problem 2: fraction returned by raycast callback was always being used, when it should only be used if it is positive. In b2DynamicTree.prototype.RayCast Before: subInput.maxFraction = input.maxFraction; maxFraction = callback(subInput, node); if (maxFraction == 0.0) return; if (maxFraction > 0.0) { After: subInput.maxFraction = maxFraction; var value = callback(subInput, node); if (value == 0.0) return; if (value > 0.0) { maxFraction = value; ---------------------------------------------------------------------------------------------- Problem 3: For 'edges' made with polygons and SetAsEdge, sometimes floating point precision caused the ray to miss the edge. In b2PolygonShape.prototype.RayCast Before: if (upper < lower - Number.MIN_VALUE) { After: if (upper < lower - 1.19209290e-7) {