triangle_normal not normalized in CollideConvexVsTriangles::Collide causing a "ioV.IsNearZero()" exception error in debug mode #1352
Replies: 5 comments 1 reply
-
|
Beta Was this translation helpful? Give feedback.
-
Thanks for the quick feedback, I understand the need of keeping the triangle_normal not normalized to avoid the expensive cost of a square root and divide calculation, |
Beta Was this translation helpful? Give feedback.
-
I would really investigate the mesh that you're sending to Jolt, the code shouldn't have to be altered. |
Beta Was this translation helpful? Give feedback.
-
Thanks, I've found the guilty triangle in one of the mesh colliders. As a side note:
The same limit with float precision also applies to the Vec4 class. |
Beta Was this translation helpful? Give feedback.
-
I've fixed the mesh collider causing the issue and set the default values back to 1.0e-12f, thanks for your advice. |
Beta Was this translation helpful? Give feedback.
-
Hello Jorrit,
The Vec3 triangle_normal variable is not normalized int the CollideConvexVsTriangles::Collide function (in line 51) , causing time to time a "ioV.IsNearZero()" exception error in EPAPenetrationDepth::GetPenetrationDepthStepGJK, (in debug mode).
Replacing line 51
Vec3 triangle_normal = mScaleSign2 * (v1 - v0).Cross(v2 - v0);
with
Vec3 triangle_normal = mScaleSign2 * (v1 - v0).Cross(v2 - v0).NormalizedOr(Vec3::sAxisY());
seems to solve the problem.
I don't know whether keeping this calculated normal unormalized is on purpose.
Cheers
Olivier
Beta Was this translation helpful? Give feedback.
All reactions