forked from bartvdbraak/blender
Fix T38335: incorrect triangle index in raycast with more than 2 quads
eb81153896 broke the fix for T38335, and this fix was incomplete, now we iterate by triangles and polys in the same while block.
This commit is contained in:
parent
2840a5de8f
commit
8647c7d501
@ -2436,7 +2436,9 @@ bool CcdShapeConstructionInfo::UpdateMesh(class KX_GameObject *gameobj, class RA
|
|||||||
m_polygonIndexArray.resize(tot_bt_tris);
|
m_polygonIndexArray.resize(tot_bt_tris);
|
||||||
|
|
||||||
|
|
||||||
for (int p = 0; p < numpolys; p++) {
|
int p = 0;
|
||||||
|
int t = 0;
|
||||||
|
while (t < tot_bt_tris) {
|
||||||
RAS_Polygon *poly = meshobj->GetPolygon(p);
|
RAS_Polygon *poly = meshobj->GetPolygon(p);
|
||||||
|
|
||||||
if (poly->IsCollider()) {
|
if (poly->IsCollider()) {
|
||||||
@ -2465,12 +2467,17 @@ bool CcdShapeConstructionInfo::UpdateMesh(class KX_GameObject *gameobj, class RA
|
|||||||
*tri_pt++ = vert_remap_array[v_orig];
|
*tri_pt++ = vert_remap_array[v_orig];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
m_polygonIndexArray[p] = p;
|
// first triangle
|
||||||
if (poly->VertexCount() == 4) {
|
m_polygonIndexArray[t] = p;
|
||||||
p++;
|
|
||||||
// if the poly is a quad we transform it in two triangles
|
// if the poly is a quad we transform it in two triangles
|
||||||
m_polygonIndexArray[p] = p;
|
if (poly->VertexCount() == 4) {
|
||||||
|
t++;
|
||||||
|
// second triangle
|
||||||
|
m_polygonIndexArray[t] = p;
|
||||||
}
|
}
|
||||||
|
t++;
|
||||||
|
p++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user