Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

raycast / raycast_query crash when length of raycast is 0 #9

Closed
8bitskull opened this issue Jan 15, 2023 · 3 comments
Closed

raycast / raycast_query crash when length of raycast is 0 #9

8bitskull opened this issue Jan 15, 2023 · 3 comments
Assignees
Labels
enhancement New feature or request

Comments

@8bitskull
Copy link

Noticed this when I was doing a raycast for a moving object. For some reason some of my frames had a dt of 0, meaning I would check the same starting and end position.

Assertion failed: r.LengthSquared() > 0.0f, file upload/daabbcc/include/DynamicTree/b2DynamicTree.h, line 209

@selimanac
Copy link
Owner

selimanac commented Jan 15, 2023

This is not an error. Raycast length must be bigger then 0.0f. And this assertion comes from Box2D lib. So you'll get this result on every un-modifield Box2D. Even Defold has this.
All I can do is to prevent crash by returning a warning if length i <= 0 , is this ok for you? Also you can check this on Lua too

@8bitskull
Copy link
Author

That makes sense! Thanks for explaining.

I'm no expert on how to design this stuff, but it seems reasonable to return no hits and display a warning. Perhaps better than a full crash.

@selimanac selimanac self-assigned this Jan 15, 2023
@selimanac selimanac added the enhancement New feature or request label Jan 15, 2023
@selimanac
Copy link
Owner

Length check added

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants