File tree Expand file tree Collapse file tree 1 file changed +15
-3
lines changed Expand file tree Collapse file tree 1 file changed +15
-3
lines changed Original file line number Diff line number Diff line change @@ -113,18 +113,30 @@ bool CalculateSimplex(
113
113
simplex.vertices [simplex.size - 1 ] = simplex.supportVertices [simplex.size - 1 ].aSupportVertex
114
114
- simplex.supportVertices [simplex.size - 1 ].bSupportVertex ;
115
115
116
- // Debug call
117
- debug::Debug::GjkCall (simplex, false );
116
+ // If next best choice within zero distance threshold - end GJK
117
+ for (uint8_t i = 0 ; i < simplex.size - 1 ; ++i)
118
+ {
119
+ if (epona::fp::IsZero (glm::distance (simplex.vertices [i], simplex.vertices [simplex.size - 1 ])))
120
+ {
121
+ simplex.size --;
122
+ debug::Debug::GjkCall (simplex, true );
123
+ return false ;
124
+ }
125
+ }
118
126
119
127
// Calculate if the new vertex is past the origin
120
128
if (epona::fp::IsLess (glm::dot (simplex.vertices [simplex.size - 1 ], direction), 0 .0f ))
121
129
{
130
+ debug::Debug::GjkCall (simplex, true );
122
131
return false ;
123
132
}
133
+
134
+ // Debug call
135
+ debug::Debug::GjkCall (simplex, false );
124
136
} while (!DoSimplex (simplex, direction) && --maxIterations);
125
137
126
138
// Debug call
127
- debug::Debug::GjkCall (simplex, static_cast < bool >(maxIterations) );
139
+ debug::Debug::GjkCall (simplex, true );
128
140
129
141
return static_cast <bool >(maxIterations);
130
142
}
You can’t perform that action at this time.
0 commit comments