Fix issue with scaling in ConcaveMeshShape

This commit is contained in:
Daniel Chappuis 2018-05-24 08:30:10 +02:00
parent 4678292b82
commit fe02f4ecc5

View File

@ -64,9 +64,15 @@ void ConcaveMeshShape::initBVHTree() {
triangleVertexArray->getTriangleVertices(triangleIndex, trianglePoints);
// Apply the scaling factor to the vertices
trianglePoints[0] *= mScaling.x;
trianglePoints[1] *= mScaling.y;
trianglePoints[2] *= mScaling.z;
trianglePoints[0].x *= mScaling.x;
trianglePoints[0].y *= mScaling.y;
trianglePoints[0].z *= mScaling.z;
trianglePoints[1].x *= mScaling.x;
trianglePoints[1].y *= mScaling.y;
trianglePoints[1].z *= mScaling.z;
trianglePoints[2].x *= mScaling.x;
trianglePoints[2].y *= mScaling.y;
trianglePoints[2].z *= mScaling.z;
// Create the AABB for the triangle
AABB aabb = AABB::createAABBForTriangle(trianglePoints);
@ -88,9 +94,15 @@ void ConcaveMeshShape::getTriangleVertices(uint subPart, uint triangleIndex,
triangleVertexArray->getTriangleVertices(triangleIndex, outTriangleVertices);
// Apply the scaling factor to the vertices
outTriangleVertices[0] *= mScaling.x;
outTriangleVertices[1] *= mScaling.y;
outTriangleVertices[2] *= mScaling.z;
outTriangleVertices[0].x *= mScaling.x;
outTriangleVertices[0].y *= mScaling.y;
outTriangleVertices[0].z *= mScaling.z;
outTriangleVertices[1].x *= mScaling.x;
outTriangleVertices[1].y *= mScaling.y;
outTriangleVertices[1].z *= mScaling.z;
outTriangleVertices[2].x *= mScaling.x;
outTriangleVertices[2].y *= mScaling.y;
outTriangleVertices[2].z *= mScaling.z;
}
// Return the three vertex normals (in the array outVerticesNormals) of a triangle