diff options
author | Porteries Tristan <republicthunderbolt9@gmail.com> | 2015-05-08 21:55:50 +0300 |
---|---|---|
committer | Porteries Tristan <republicthunderbolt9@gmail.com> | 2015-05-08 22:12:36 +0300 |
commit | 6ee0327594b2308b3111e1b8a7e52ed5959899fc (patch) | |
tree | 50da483431a33356b0da4eda17ec45f4826b91fa | |
parent | a08d90f0706270c87352ff7c33777905291c45a1 (diff) |
Fix T38335: incorrect triangle index in raycast result
Previously we forgot to do a special operation for indexes to convert a quad to two triangles.
-rw-r--r-- | source/gameengine/Physics/Bullet/CcdPhysicsController.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp b/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp index b6d2f849437..4285093fde0 100644 --- a/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp +++ b/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp @@ -2382,7 +2382,6 @@ bool CcdShapeConstructionInfo::UpdateMesh(class KX_GameObject *gameobj, class RA * RAS Mesh Update * * */ - /* Note!, gameobj can be NULL here */ /* transverts are only used for deformed RAS_Meshes, the RAS_TexVert data @@ -2437,7 +2436,7 @@ bool CcdShapeConstructionInfo::UpdateMesh(class KX_GameObject *gameobj, class RA m_polygonIndexArray.resize(tot_bt_tris); - for (int p = 0; p < numpolys; p++) { + for (int p = 0; p < numpolys;) { RAS_Polygon *poly = meshobj->GetPolygon(p); if (poly->IsCollider()) { @@ -2466,7 +2465,12 @@ bool CcdShapeConstructionInfo::UpdateMesh(class KX_GameObject *gameobj, class RA *tri_pt++ = vert_remap_array[v_orig]; } } - m_polygonIndexArray[p] = p; /* dumb counting */ + m_polygonIndexArray[p] = p; + if (poly->VertexCount() == 4) { + // if the poly is a quad we transform it in two triangles + m_polygonIndexArray[p + 1] = p++; + } + p++; } } |