Stack trace from "WARNING:PHYSICS"?

Happily, the zero length raycast bug was fixed in Fixed Crash when using raycasts under certain conditions by DarkRavenStar · Pull Request #11357 · defold/defold · GitHub

However, I now see this warning:

WARNING:PHYSICS: Ray had 0 length when ray casting after applying physics scale, ignoring request.

Is there a way to get a stack trace at this point, so that I can see which of the many raycasts are triggering it & debug?

By wrapping every raycast call I was able to figure out what’s happening, but I wonder if this particular warning might be more useful with some more context about what file/line/stack it’s coming from.

Yes, that would probably be helpful. It is unfortunate that we return nil when there are no hits instead of an empty table. If we used nil as an indicator that something went wrong then developers could assert and get a stacktrace.

1 Like

Yep! I access rays through a wrapper that returns result or {} - that must be a common pattern to avoid endless nil checks.