bugfix for compound versus concave: compute the DeltaC2 after computing the (child) transforms for proper center

This commit is contained in:
erwin coumans
2013-04-12 13:02:35 -07:00
parent ec0d2ed523
commit 07b89beb39
9 changed files with 75 additions and 56 deletions

View File

@@ -1406,13 +1406,9 @@ static const char* satClipKernelsCL= \
" posA.w = 0.f;\n"
" float4 posB = rigidBodies[bodyIndexB].m_pos;\n"
" posB.w = 0.f;\n"
" float4 c0local = convexPolyhedronA.m_localCenter;\n"
" float4 ornA = rigidBodies[bodyIndexA].m_quat;\n"
" float4 c0 = transform(&c0local, &posA, &ornA);\n"
" float4 c1local = convexShapes[shapeIndexB].m_localCenter;\n"
" float4 ornB =rigidBodies[bodyIndexB].m_quat;\n"
" float4 c1 = transform(&c1local,&posB,&ornB);\n"
" const float4 DeltaC2 = c0 - c1;\n"
"\n"
"\n"
" float4 sepAxis = separatingNormals[i];\n"
" \n"
@@ -1421,16 +1417,17 @@ static const char* satClipKernelsCL= \
" {\n"
" ///////////////////\n"
" ///compound shape support\n"
" int compoundChild = concavePairsIn[pairIndex].w;\n"
" int childShapeIndexB = collidables[collidableIndexB].m_shapeIndex+compoundChild;\n"
" \n"
" int childShapeIndexB = concavePairsIn[pairIndex].w;\n"
" int childColIndexB = gpuChildShapes[childShapeIndexB].m_shapeIndex;\n"
" shapeIndexB = collidables[childColIndexB].m_shapeIndex;\n"
" float4 childPosB = gpuChildShapes[childShapeIndexB].m_childPosition;\n"
" float4 childOrnB = gpuChildShapes[childShapeIndexB].m_childOrientation;\n"
" float4 newPosB = transform(&childPosB,&posB,&ornB);\n"
" float4 newOrnB = qtMul(ornB,childOrnB);\n"
" posB = newPosB;\n"
" ornB = newOrnB;\n"
" shapeIndexB = collidables[childColIndexB].m_shapeIndex;\n"
" \n"
" }\n"
" \n"
" ////////////////////////////////////////\n"