BGE: Fix physics meshes conversion with modifiers.
authorPorteries Tristan <republicthunderbolt9@gmail.com>
Wed, 21 Oct 2015 10:15:35 +0000 (12:15 +0200)
committerPorteries Tristan <republicthunderbolt9@gmail.com>
Wed, 21 Oct 2015 10:15:35 +0000 (12:15 +0200)
Previously meshes with modifiers were considerate as empty (no polys).

source/gameengine/Physics/Bullet/CcdPhysicsController.cpp

index f11d7ac017f1ed483d510372a425663325a4b66e..dba65c047293e6d95d1d3b3f087e9298a3f56566 100644 (file)
@@ -1870,9 +1870,11 @@ bool CcdShapeConstructionInfo::SetMesh(RAS_MeshObject *meshobj, DerivedMesh *dm,
        if (!dm) {
                free_dm = true;
                dm = CDDM_from_mesh(meshobj->GetMesh());
-               DM_ensure_tessface(dm);
        }
 
+       // Some meshes with modifiers returns 0 polys, call DM_ensure_tessface avoid this.
+       DM_ensure_tessface(dm);
+
        MVert *mvert = dm->getVertArray(dm);
        MFace *mface = dm->getTessFaceArray(dm);
        numpolys = dm->getNumTessFaces(dm);