mirror of
https://github.com/love2d/love.git
synced 2026-08-15 15:51:12 +02:00
Return nil if the raycasts don't hit anything (issue #335)
This commit is contained in:
@@ -107,7 +107,8 @@ namespace box2d
|
||||
input.maxFraction = maxFraction;
|
||||
b2Transform transform(b2Vec2(x, y), b2Rot(r));
|
||||
b2RayCastOutput output;
|
||||
shape->RayCast(&output, input, transform, childIndex);
|
||||
if (!shape->RayCast(&output, input, transform, childIndex))
|
||||
return 0; // No hit.
|
||||
lua_pushnumber(L, Physics::scaleUp(output.normal.x));
|
||||
lua_pushnumber(L, Physics::scaleUp(output.normal.y));
|
||||
lua_pushnumber(L, output.fraction);
|
||||
|
||||
Reference in New Issue
Block a user