Physics.ray...crash

Each time I use physics.raycast it crashes my program here’s the code I’m using

if physics.raycast(touch.x,rx) and physics.raycast(touch.y, ry) then
print("c = "..(math.pi *  (rx + 250)))
end

I put that near the beginning of my touched function and im kicked out of codea as soon as I touch the screen.

Those are incorrect parameters for physics.raycast, see http://twolivesleft.com/Codea/Reference/#detail/index/physics.raycast for correct parameters and return values. You could try defining a function to check if there is something at a given position:

function checkLocation(x,y)
    return #physics.queryAABB(vec2(x,y), vec2(x,y)) > 0
end

I’ll look into the reason why its crashing when you supply incorrect parameters.

I know it’s more or less incorrect data, but when you call physics.raycast with two vec2 that are the same, it crashes Codea.

Thanks for letting me know. If you can please use the issue tracker to submit bugs: https://bitbucket.org/TwoLivesLeft/codea/issues

Submitted: https://bitbucket.org/TwoLivesLeft/codea/issue/192/physicsraycast-crash