diff --git a/Extras/BulletColladaConverter/ColladaConverter.cpp b/Extras/BulletColladaConverter/ColladaConverter.cpp index 5ab42631f..b0c4cd6a5 100644 --- a/Extras/BulletColladaConverter/ColladaConverter.cpp +++ b/Extras/BulletColladaConverter/ColladaConverter.cpp @@ -1362,7 +1362,7 @@ ColladaConverter::addConcaveMesh(btCollisionShape* shape, const char* nodeName) btAssert (vertexBase); btAssert (indexBase); btAssert (vertexType == PHY_FLOAT); - btAssert (indexType == PHY_INTEGER); + //we will need 3 sources for this mesh. positions, normals, and UVs domSource *positionSrc = daeSafeCast( mesh->createAndPlace( COLLADA_ELEMENT_SOURCE ) ); @@ -1428,14 +1428,24 @@ ColladaConverter::addConcaveMesh(btCollisionShape* shape, const char* nodeName) //each set of three is one number per input-offset. for this example it's vert, normal, uv. //three sets of three indices per triangle - for (int t = 0; t < numFaces; t++) + if (indexType == PHY_SHORT) { - int* index = (int*)indexBase; - indices.append3( index[0], index[1], index[2]); - indexBase += indexStride; + for (int t = 0; t < numFaces; t++) + { + short int* index = (short int*)indexBase; + indices.append3( index[0], index[1], index[2]); + indexBase += indexStride; + } + } else + { + for (int t = 0; t < numFaces; t++) + { + int* index = (int*)indexBase; + indices.append3( index[0], index[1], index[2]); + indexBase += indexStride; + } } - meshInterface->unLockReadOnlyVertexBase (i); } } diff --git a/src/BulletCollision/CollisionDispatch/btManifoldResult.cpp b/src/BulletCollision/CollisionDispatch/btManifoldResult.cpp index 61c4c231d..b6bc609ed 100644 --- a/src/BulletCollision/CollisionDispatch/btManifoldResult.cpp +++ b/src/BulletCollision/CollisionDispatch/btManifoldResult.cpp @@ -87,6 +87,11 @@ void btManifoldResult::addContactPoint(const btVector3& normalOnBInWorld,const b newPt.m_combinedFriction = calculateCombinedFriction(m_body0,m_body1); newPt.m_combinedRestitution = calculateCombinedRestitution(m_body0,m_body1); + //BP mod, store contact triangles. + newPt.m_partId0 = m_partId0; + newPt.m_partId1 = m_partId1; + newPt.m_index0 = m_index0; + newPt.m_index1 = m_index1; ///todo, check this for any side effects if (insertIndex >= 0) diff --git a/src/BulletCollision/NarrowPhaseCollision/btManifoldPoint.h b/src/BulletCollision/NarrowPhaseCollision/btManifoldPoint.h index 99bea8f26..46090aee4 100644 --- a/src/BulletCollision/NarrowPhaseCollision/btManifoldPoint.h +++ b/src/BulletCollision/NarrowPhaseCollision/btManifoldPoint.h @@ -65,6 +65,11 @@ class btManifoldPoint btScalar m_combinedFriction; btScalar m_combinedRestitution; + //BP mod, store contact triangles. + int m_partId0; + int m_partId1; + int m_index0; + int m_index1; mutable void* m_userPersistentData; btScalar m_appliedImpulse;