-
-
Notifications
You must be signed in to change notification settings - Fork 221
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
NaN quaternion assert, master #79
Comments
Hello, Thanks a lot for reporting this issue. Since you can reproduce the issue on your side, can I ask you to try to find the commit between v0.7.0 and master that seems to break something ? It would help me a lot. |
It is not 100% reproducible, but after some tries the code will assert. I will try to track down the commit |
The issue seems to be related to changes done in 45f86ea. The image below show the pile of approx. 200 objects which can produce this issue. From v0.7.0 I get: reactphysics3d/src/collision/ContactPointInfo.h:82: reactphysics3d::ContactPointInfo::ContactPointInfo(const reactphysics3d::Vector3&, reactphysics3d::decimal, const reactphysics3d::Vector3&, const reactphysics3d::Vector3&): Assertion `contactNormal.lengthSquare() > decimal(0.8)' failed. From 45f86ea ("Fix issue with ConvexMeshShape and BoxShape falling through ConcaveMeshShape and HeightFieldShape", 2018-07-01) I get: reactphysics3d/src/mathematics/Quaternion.h:266: reactphysics3d::Quaternion reactphysics3d::Quaternion::getUnit() const: Assertion `lengthQuaternion > MACHINE_EPSILON' failed. |
So if I understand correctly, you also have an assert with the 0.7.0 branch.
Can I ask you to post the whole stacktrace for this assert with the 0.7.0 branch ? |
Yes. When backtracking I found that v0.7.0 asserts in ContactPointInfo and from 45f86ea i got the quaternion assert. |
Based on v0.7.0 (gdb) frame 11 |
Thanks a lot. I think I will need to reproduce it on my side to find the issue. Are you able to share the code that you use to create the bodies and collision shapes of your scene ? |
I have pushed some changes in the commit 6bcb586 in the master branch. Can you try again and let me know if the issue still occurs in master ? If so, does the same assert raises or another one ? |
Tried 6bcb586 and still get the assert: (gdb) frame 4 |
Tried another experiment:
I needed the assert limit to be 1.1 in order to pass the length calculation. Seems as if quats calculation precision errors are accumulated in the quat somewhere. You may need to normalize the quats if these are accumulated. Unsure if this is the case. By use of the 1.1 I got the following:
Note that I instrumented all input pos and quat from my code to reactphysics which did not assert |
I do renormalize the orientation quaternions each frame. It's hard to find the issue without being able to reproduce it on my side. I have created the issue79 branch with some new asserts. Can you please try this branch ? I expect that another assert is raised. If so, can you post the whole stack trace (with the state of the variables) ? Thanks for your help. |
Sorry for the late response. Tried you issue79 branch and got the following:
|
I have added more asserts in the issue79 branch. Can you pull the changes and report again the stack trace and variables status when an assert is hit ? I need to know where in the code the linear or angular velocity starts to become NaN. |
(gdb) f 4 |
Thanks a lot for your help. I have added more asserts in the issue79 branch. Can you pull the branch and try again ? |
The issue originates from invalid penetrationDepth which result in infinit biasPenetrationDepth which result in infinit deltaLambdaSplit which result in infinit linearImpulse which result in the previous assert comment (gdb) f 4 My local changes looks like this:
|
Thanks. Yes it seems the penetrationDepth is the maximum floating number (DECIMAL_LARGEST constant in the code). I have added more asserts in the issue79 branch to track in which collision method this penetration depth is set. Could you pull the branch and try it ? |
(gdb) f 4 |
Hello. Have you been able to test the fix ? |
I have just merged the fix into the "master" branch. |
Hi Daniel
I am trying a game scene which works using v0.7.0, but when I swap to the latest master I get the following assert.
The assert originates from a NaN lenght of the quaternion.
(gdb) frame 4
#4 0x000000000063f22c in reactphysics3d::Quaternion::getUnit (this=0x1462184) at /src/mathematics/Quaternion.h:266
266 assert (lengthQuaternion > MACHINE_EPSILON);
(gdb) info locals
lengthQuaternion = -nan(0x400000)
PRETTY_FUNCTION = "reactphysics3d::Quaternion reactphysics3d::Quaternion::getUnit() const"
#5 0x000000000063ce05 in reactphysics3d::DynamicsWorld::updateBodiesState (this=0x993820) at /src/engine/DynamicsWorld.cpp:222
222 bodies[b]->mTransform.setOrientation(mConstrainedOrientations[index].getUnit());
(gdb) info locals
index = 2
b = 0
bodies = 0x1427e90
islandIndex = 0
The text was updated successfully, but these errors were encountered: