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

added checks to prevent box2d crashing #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

voodoosoft
Copy link

with "Expression: r.LengthSquared() > 0.0f"

@piotr-j
Copy link
Owner

piotr-j commented Dec 30, 2016

Does this actually solve a problem for you?
I think doing the check just before raycast is too late, we want to use as many valid rays as we can and that doesnt help. Perhaps the check could be move to https://github.com/piotr-j/box2dlights/blob/master/src/box2dLight/SmoothPositionalLight.java#L274 somewhere in Positional lights case?
Short ray is already checked for in https://github.com/piotr-j/box2dlights/blob/master/src/box2dLight/SmoothLineLight.java#L512 for line lights apparently.

@voodoosoft
Copy link
Author

voodoosoft commented Dec 30, 2016 via email

@piotr-j
Copy link
Owner

piotr-j commented Jan 10, 2017

Did you try moving the check to the accept method that ive linked above? I dont really want to spam the check everywhere if it can be avoided.

A repro case or some details on the light that was causing it would be great. Ive tried doing a lot of crazy things on the example app. Perhaps it crashes on devices only or something?

@voodoosoft
Copy link
Author

Only the added checks avoid crashing for me. But I do not understand enough of the library to say if can't be done better.
I am only point and cone lights.

@piotr-j
Copy link
Owner

piotr-j commented Jan 20, 2017

Its been a while but check this branch if you can if it fixes the problem.

@voodoosoft
Copy link
Author

voodoosoft commented Jan 22, 2017 via email

@piotr-j
Copy link
Owner

piotr-j commented Jan 22, 2017

Oh well, Ill keep on guessing what you are doing to make it crash!

@voodoosoft
Copy link
Author

voodoosoft commented Jan 22, 2017 via email

@piotr-j
Copy link
Owner

piotr-j commented Jan 22, 2017

Well, you are doing something weird. The only way ive manged to crash like that is by setting the lights distance to 0, which cant be done normally. Im 90% sure that extra rays are never close to zero len, that leaves the base rays, but they are set to be the length of the light. Which type of light crashes? Run with one at the time or something. All of them? Specific? Log how many 0 len rays there are in ray. Give me something to work with.

I did manage to find some bugs in point lights, so thats a plus i guess.

@voodoosoft
Copy link
Author

voodoosoft commented Jan 22, 2017 via email

piotr-j pushed a commit that referenced this pull request Oct 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants