Просмотр исходного кода

Bugfix: Penetration depth of mesh/heightfield vs soft body vertex had the wrong sign

Jorrit Rouwe 2 лет назад
Родитель
Сommit
df22a599ef
1 измененных файлов с 1 добавлено и 1 удалено
  1. 1 1
      Jolt/Physics/Collision/Shape/Shape.cpp

+ 1 - 1
Jolt/Physics/Collision/Shape/Shape.cpp

@@ -290,7 +290,7 @@ void Shape::sCollideSoftBodyVerticesUsingRayCast(const Shape &inShape, Mat44Arg
 			if (inShape.CastRay(ray.Transformed(inverse_transform), SubShapeIDCreator(), hit))
 			if (inShape.CastRay(ray.Transformed(inverse_transform), SubShapeIDCreator(), hit))
 			{
 			{
 				// Calculate penetration
 				// Calculate penetration
-				float penetration = (hit.mFraction - 0.5f) * movement.Length();
+				float penetration = (0.5f - hit.mFraction) * movement.Length();
 				if (penetration > v.mLargestPenetration)
 				if (penetration > v.mLargestPenetration)
 				{
 				{
 					v.mLargestPenetration = penetration;
 					v.mLargestPenetration = penetration;