Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPorteries Tristan <republicthunderbolt9@gmail.com>2015-05-09 19:45:54 +0300
committerPorteries Tristan <republicthunderbolt9@gmail.com>2015-05-09 20:12:22 +0300
commit8647c7d5010a844349ea6f7d180408cafbbb4848 (patch)
treee2c246e5cd6ec35b5cdf1834441604b2c8d47923 /source/gameengine
parent2840a5de8f26835df8e8a43972fd3eb2bae0ef73 (diff)
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.
Diffstat (limited to 'source/gameengine')
-rw-r--r--source/gameengine/Physics/Bullet/CcdPhysicsController.cpp17
1 files changed, 12 insertions, 5 deletions
diff --git a/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp b/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp
index 5c5a4d3cc56..48f85410cf0 100644
--- a/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp
+++ b/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp
@@ -2436,7 +2436,9 @@ bool CcdShapeConstructionInfo::UpdateMesh(class KX_GameObject *gameobj, class RA
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);
if (poly->IsCollider()) {
@@ -2465,12 +2467,17 @@ bool CcdShapeConstructionInfo::UpdateMesh(class KX_GameObject *gameobj, class RA
*tri_pt++ = vert_remap_array[v_orig];
}
}
- m_polygonIndexArray[p] = p;
+ // first triangle
+ m_polygonIndexArray[t] = p;
+
+ // if the poly is a quad we transform it in two triangles
if (poly->VertexCount() == 4) {
- p++;
- // if the poly is a quad we transform it in two triangles
- m_polygonIndexArray[p] = p;
+ t++;
+ // second triangle
+ m_polygonIndexArray[t] = p;
}
+ t++;
+ p++;
}
}