-
Notifications
You must be signed in to change notification settings - Fork 474
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
GJKClosestPoint::CastShape gets stuck in an infinite loop #1383
Comments
Hello, I've encountered this before, and that The problem is that NaNs get introduced in the system in the first place and in my experience the NaNs are never generated in If it is possible, it would really help if you can create a repro case that I can run myself. The simplest way is usually to edit
But that works fine. |
I also tried setting the position of the body, the start of the cast or the direction of the cast to |
Hello. I am the stupidest but also I'm not. In Mat44.h:
For some reason I just assumed default constructed primitives are initialized. So I was getting NaNs from uninitialized memory - go figure. When I fix it with:
The problem does go away. Now the behavior is correct. BUT if I were to say: unfix it. There's still the question of why does the loop not exit. So I hacked in an explicit check for NaN in
With that check the code behaves exactly as expected and the problem disappears as well. Conclusion 1: I used the library wrong. Sorry. I hope I haven't completely wasted your time. If it weren't for your informative response I would still probably be banging my head against a wall. Regards |
When the origin of a narrow phase shape cast is close to a kinematic body that it's supposed to hit, the
GJKClosestPoint::CastShape
gets stuck in an infinite loop. The cast doesn't need to hit the body for this problem to occur. It doesn't happen when the origin of the cast is away from the body even if it does hit near the end.It happens reliably every time. Shape of the body and direction of the cast doesn't seem to make a difference.
The issue doesn't happen in a debug build so it's hard for me to see the exact state involved. but I've managed to gather that local variable
v
is{-nan, -nan, -nan, -nan}
. According to comment inGJKClosestPoint::GetClosest
the NaN is accounted for.if (v_len_sq < inPrevVLenSq) // Note, comparison order important: If v_len_sq is NaN then this expression will be false so we will return false
Trying to step through the function in release is not super useful but it does confirm that the loop never exits.
I'm sorry if this is vague. I'm a little over my head, not sure what other information could be useful.
Jolt version: release 5.2.0
MSVC version: 193833133
Optimization is on
/O2
Floating point model is
/fp:strict
with/fp:except
enabledJPH_FLOATING_POINT_EXCEPTIONS_ENABLED
is defined as wellThe text was updated successfully, but these errors were encountered: