소스 검색

Fixed passing underestimate of penetration depth in ContactListener::OnContactPersisted

The penetration depth calculation in `ContactConstraintsManager::GetContactsFromCache()` was using the first relative contact points for each iteration of the loop.
Nicholas Zollinger 2 달 전
부모
커밋
d811492a31
1개의 변경된 파일1개의 추가작업 그리고 1개의 파일을 삭제
  1. 1 1
      Jolt/Physics/Constraints/ContactConstraintManager.cpp

+ 1 - 1
Jolt/Physics/Constraints/ContactConstraintManager.cpp

@@ -923,7 +923,7 @@ void ContactConstraintManager::GetContactsFromCache(ContactAllocator &ioContactA
 				const CachedContactPoint &ccp = output_cm->mContactPoints[i];
 				manifold.mRelativeContactPointsOn1[i] = transform_body1.Multiply3x3(Vec3::sLoadFloat3Unsafe(ccp.mPosition1));
 				manifold.mRelativeContactPointsOn2[i] = local_transform_body2 * Vec3::sLoadFloat3Unsafe(ccp.mPosition2);
-				penetration_depth = max(penetration_depth, (manifold.mRelativeContactPointsOn1[0] - manifold.mRelativeContactPointsOn2[0]).Dot(world_space_normal));
+				penetration_depth = max(penetration_depth, (manifold.mRelativeContactPointsOn1[i] - manifold.mRelativeContactPointsOn2[i]).Dot(world_space_normal));
 			}
 			manifold.mPenetrationDepth = penetration_depth; // We don't have the penetration depth anymore, estimate it