Browse Source

Fix BodySetIslandIndex SolvePositionConstraints race condition (#884)

Sometimes bodies would be marked as part of an island even though they were put to sleep. This happens because SolvePositionConstraints puts the body to sleep at the same time as BodySetIslandIndex runs.

Co-authored-by: Jorrit Rouwe <[email protected]>
Ori Cohen 1 year ago
parent
commit
018a17af20
3 changed files with 47 additions and 61 deletions
  1. 41 55
      Docs/PhysicsSystemUpdate.drawio
  2. 0 0
      Docs/PhysicsSystemUpdate.svg
  3. 6 6
      Jolt/Physics/PhysicsSystem.cpp

+ 41 - 55
Docs/PhysicsSystemUpdate.drawio

@@ -1,4 +1,4 @@
-<mxfile host="app.diagrams.net" modified="2023-12-11T20:08:54.047Z" agent="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36" etag="nJirzh5xXBcsb4evVA8J" version="21.8.2" type="device">
+<mxfile host="app.diagrams.net" modified="2024-01-22T19:21:08.802Z" agent="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36" etag="1-bB5xyBy8A0LU8A59eh" version="22.1.18" type="device">
   <diagram id="rLFVS3KHCrdhIcSo5p6n" name="Page-1">
     <mxGraphModel dx="1562" dy="810" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="850" pageHeight="1100" background="#FFFFFF" math="0" shadow="0">
       <root>
@@ -59,7 +59,7 @@
           <mxGeometry x="1456.2425537109375" y="136.25" width="100" height="92" as="geometry" />
         </mxCell>
         <mxCell id="14" style="shape=ellipse;perimeter=ellipsePerimeter;shadow=0;strokeWidth=2;fillColor=#000000;strokeColor=#333333;opacity=100.0;gliffyId=100;" parent="1" vertex="1">
-          <mxGeometry x="2210.0025537109377" y="332.7" width="15" height="15" as="geometry" />
+          <mxGeometry x="2200.0025537109377" y="174.04999999999998" width="15" height="15" as="geometry" />
         </mxCell>
         <mxCell id="15" style="shape=filledEdge;strokeWidth=2;strokeColor=#000000;fillColor=none;startArrow=none;startFill=0;startSize=6;endArrow=block;endFill=1;endSize=6;rounded=0;gliffyId=114;exitX=1.0;exitY=0.5;exitPerimeter=0;entryX=1.1102230246251565E-16;entryY=0.2928932309150696;entryPerimeter=0;" parent="1" source="77" target="71" edge="1">
           <mxGeometry width="100" height="100" relative="1" as="geometry">
@@ -110,31 +110,17 @@
           </mxGeometry>
         </mxCell>
         <mxCell id="22" value="&lt;div style=&#39;width: 141.96px;height:auto;word-break: break-word;&#39;&gt;&lt;div align=&quot;center&quot;&gt;&lt;span style=&quot;font-size: 12px; font-family: Arial; white-space: pre-wrap; text-decoration: none; line-height: 14px; color: rgb(0, 0, 0);&quot;&gt;Set Body Island Idx&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;" style="shape=rect;shadow=0;strokeWidth=2;fillColor=#ffffff;strokeColor=#333333;opacity=100.0;html=1;nl2Br=0;verticalAlign=middle;align=center;spacingLeft=3.02;spacingRight=0;whiteSpace=wrap;gliffyId=152;" parent="1" vertex="1">
-          <mxGeometry x="1399.9999731445314" y="436.7460791015625" width="151" height="65.1060791015625" as="geometry" />
+          <mxGeometry x="713.6599731445314" y="315.6960791015625" width="151" height="65.1060791015625" as="geometry" />
         </mxCell>
         <mxCell id="23" style="shape=filledEdge;strokeWidth=2;strokeColor=#000000;fillColor=none;startArrow=none;startFill=0;startSize=6;endArrow=block;endFill=1;endSize=6;rounded=0;gliffyId=154;exitX=1.0;exitY=0.5;exitPerimeter=0;entryX=0.0;entryY=0.5;entryPerimeter=0;" parent="1" source="10" target="22" edge="1">
-          <mxGeometry width="100" height="100" relative="1" as="geometry">
-            <Array as="points">
-              <mxPoint x="665" y="348.25" />
-              <mxPoint x="713.6600341796875" y="469.15911865234375" />
-            </Array>
-          </mxGeometry>
+          <mxGeometry width="100" height="100" relative="1" as="geometry" />
         </mxCell>
-        <mxCell id="24" style="shape=filledEdge;strokeWidth=2;strokeColor=#000000;fillColor=none;startArrow=none;startFill=0;startSize=6;endArrow=block;endFill=1;endSize=6;rounded=0;gliffyId=155;edgeStyle=orthogonalEdgeStyle;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" parent="1" source="22" target="2HlbSkl1Hx2XcQlONuJN-122" edge="1">
-          <mxGeometry width="100" height="100" relative="1" as="geometry">
-            <Array as="points">
-              <mxPoint x="1580" y="469" />
-              <mxPoint x="1580" y="340" />
-            </Array>
-          </mxGeometry>
+        <mxCell id="24" style="shape=filledEdge;strokeWidth=2;strokeColor=#000000;fillColor=none;startArrow=none;startFill=0;startSize=6;endArrow=block;endFill=1;endSize=6;rounded=0;gliffyId=155;entryX=0.5;entryY=1;entryDx=0;entryDy=0;exitX=1;exitY=0.5;exitDx=0;exitDy=0;edgeStyle=orthogonalEdgeStyle;" parent="1" source="22" target="13" edge="1">
+          <mxGeometry width="100" height="100" relative="1" as="geometry" />
         </mxCell>
-        <mxCell id="26" style="shape=filledEdge;strokeWidth=2;strokeColor=#000000;fillColor=none;startArrow=none;startFill=0;startSize=6;endArrow=block;endFill=1;endSize=6;rounded=0;gliffyId=171;edgeStyle=orthogonalEdgeStyle;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" parent="1" source="13" target="2HlbSkl1Hx2XcQlONuJN-122" edge="1">
+        <mxCell id="26" style="shape=filledEdge;strokeWidth=2;strokeColor=#000000;fillColor=none;startArrow=none;startFill=0;startSize=6;endArrow=block;endFill=1;endSize=6;rounded=0;gliffyId=171;entryX=0;entryY=0.5;entryDx=0;entryDy=0;exitX=1;exitY=0.5;exitDx=0;exitDy=0;" parent="1" source="13" target="2HlbSkl1Hx2XcQlONuJN-122" edge="1">
           <mxGeometry width="100" height="100" relative="1" as="geometry">
-            <Array as="points">
-              <mxPoint x="1580" y="182" />
-              <mxPoint x="1580" y="340" />
-            </Array>
-            <mxPoint x="1623.1999999999998" y="182.2862958122704" as="sourcePoint" />
+            <mxPoint x="1560" y="180" as="sourcePoint" />
           </mxGeometry>
         </mxCell>
         <mxCell id="28" value="&lt;div style=&#39;width: 13.32px;height:auto;word-break: break-word;&#39;&gt;&lt;div align=&quot;center&quot;&gt;&lt;span style=&quot;font-size: 12px; font-family: Arial; white-space: pre-wrap; text-decoration: none; line-height: 14px; color: rgb(0, 0, 0);&quot;&gt;P&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;" style="shape=rect;shadow=0;strokeWidth=2;fillColor=#00ff00;strokeColor=#333333;gradientColor=#AAFFAA;gradientDirection=north;opacity=100.0;html=1;nl2Br=0;verticalAlign=middle;align=center;spacingLeft=0.34;spacingRight=0;whiteSpace=wrap;gliffyId=191;" parent="1" vertex="1">
@@ -228,13 +214,11 @@
           </mxGeometry>
         </mxCell>
         <mxCell id="57" value="&lt;div style=&#39;width: 93.0px;height:auto;word-break: break-word;&#39;&gt;&lt;div align=&quot;center&quot;&gt;&lt;span style=&quot;font-size: 12px; font-family: Arial; white-space: pre-wrap; text-decoration: none; line-height: 14px; color: rgb(0, 0, 0);&quot;&gt;Start Next Step&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;" style="shape=rect;shadow=0;strokeWidth=2;fillColor=#ffffff;strokeColor=#333333;opacity=100.0;html=1;nl2Br=0;verticalAlign=middle;align=center;spacingLeft=2.0;spacingRight=0;whiteSpace=wrap;gliffyId=311;" parent="1" vertex="1">
-          <mxGeometry x="1979.997548828125" y="531" width="100" height="37.3939208984375" as="geometry" />
+          <mxGeometry x="1963.757548828125" y="528.43" width="100" height="37.3939208984375" as="geometry" />
         </mxCell>
-        <mxCell id="58" style="shape=filledEdge;strokeWidth=2;strokeColor=#000000;fillColor=none;startArrow=none;startFill=0;startSize=6;endArrow=block;endFill=1;endSize=6;rounded=0;gliffyId=313;exitX=1.0;exitY=0.5;exitPerimeter=0;entryX=0.0;entryY=0.5;entryPerimeter=0;" parent="1" source="104" target="14" edge="1">
+        <mxCell id="58" style="shape=filledEdge;strokeWidth=2;strokeColor=#000000;fillColor=none;startArrow=none;startFill=0;startSize=6;endArrow=block;endFill=1;endSize=6;rounded=0;gliffyId=313;exitX=1.0;exitY=0.5;exitPerimeter=0;" parent="1" source="104" edge="1">
           <mxGeometry width="100" height="100" relative="1" as="geometry">
-            <Array as="points">
-              <mxPoint x="2147.252431640625" y="340.8" />
-            </Array>
+            <mxPoint x="2200" y="182.5" as="targetPoint" />
           </mxGeometry>
         </mxCell>
         <mxCell id="59" value="&lt;div style=&#39;width: 178.16px;height:auto;word-break: break-word;&#39;&gt;&lt;div align=&quot;left&quot;&gt;&lt;span style=&quot;font-size: 12px; font-family: Arial; white-space: pre-wrap; line-height: 14px; color: rgb(0, 0, 0);&quot;&gt;Repeat CollisionStep Times&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;" style="text;html=1;nl2Br=0;html=1;nl2Br=0;verticalAlign=middle;align=left;spacingLeft=0.0;spacingRight=0;whiteSpace=wrap;gliffyId=323;" parent="1" vertex="1">
@@ -391,38 +375,40 @@
           <mxGeometry x="1208.2425537109375" y="218.75" width="17" height="17" as="geometry" />
         </mxCell>
         <mxCell id="95" value="&lt;div style=&#39;width: 165.0px;height:auto;word-break: break-word;&#39;&gt;&lt;div align=&quot;center&quot;&gt;&lt;span style=&quot;font-size: 12px; font-family: Arial; white-space: pre-wrap; text-decoration: none; line-height: 14px; color: rgb(0, 0, 0);&quot;&gt;Finalize Contact Cache, &lt;/span&gt;&lt;/div&gt;&lt;div align=&quot;center&quot;&gt;&lt;span style=&quot;font-size: 12px; font-family: Arial; white-space: pre-wrap; text-decoration: none; line-height: 14px; color: rgb(0, 0, 0);&quot;&gt;Contact Removed Callbacks&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;" style="shape=rect;shadow=0;strokeWidth=2;fillColor=#ffffff;strokeColor=#333333;opacity=100.0;html=1;nl2Br=0;verticalAlign=middle;align=center;spacingLeft=3.5;spacingRight=0;whiteSpace=wrap;gliffyId=538;" parent="1" vertex="1">
-          <mxGeometry x="1381.2425097656248" y="310.4015197753906" width="175" height="60.69696044921875" as="geometry" />
+          <mxGeometry x="1292.7425097656248" y="265.6015197753906" width="175" height="60.69696044921875" as="geometry" />
         </mxCell>
         <mxCell id="96" style="shape=filledEdge;strokeWidth=2;strokeColor=#000000;fillColor=none;startArrow=none;startFill=0;startSize=6;endArrow=block;endFill=1;endSize=6;rounded=0;fixDash=1;gliffyId=540;edgeStyle=orthogonalEdgeStyle;" parent="1" source="86" target="95" edge="1">
           <mxGeometry width="100" height="100" relative="1" as="geometry">
             <Array as="points">
-              <mxPoint x="1258" y="341" />
+              <mxPoint x="1258" y="296" />
             </Array>
           </mxGeometry>
         </mxCell>
-        <mxCell id="97" style="shape=filledEdge;strokeWidth=2;strokeColor=#000000;fillColor=none;startArrow=none;startFill=0;startSize=6;endArrow=block;endFill=1;endSize=6;rounded=0;gliffyId=542;exitX=1.0;exitY=0.5;exitPerimeter=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" parent="1" source="95" target="2HlbSkl1Hx2XcQlONuJN-122" edge="1">
+        <mxCell id="97" style="shape=filledEdge;strokeWidth=2;strokeColor=#000000;fillColor=none;startArrow=none;startFill=0;startSize=6;endArrow=block;endFill=1;endSize=6;rounded=0;gliffyId=542;exitX=1;exitY=0.5;entryX=0;entryY=0.5;entryDx=0;entryDy=0;elbow=vertical;exitDx=0;exitDy=0;edgeStyle=orthogonalEdgeStyle;" parent="1" source="95" target="104" edge="1">
           <mxGeometry width="100" height="100" relative="1" as="geometry">
             <Array as="points">
-              <mxPoint x="1590" y="340" />
+              <mxPoint x="2071" y="296" />
             </Array>
+            <mxPoint x="1467.742509765625" y="270.85" as="sourcePoint" />
+            <mxPoint x="2091.0025537109377" y="315.69999999999993" as="targetPoint" />
           </mxGeometry>
         </mxCell>
         <mxCell id="98" value="&lt;div style=&#39;width: 13.32px;height:auto;word-break: break-word;&#39;&gt;&lt;div align=&quot;center&quot;&gt;&lt;span style=&quot;font-size: 12px; font-family: Arial; white-space: pre-wrap; text-decoration: none; line-height: 14px; color: rgb(0, 0, 0);&quot;&gt;V&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;" style="shape=rect;shadow=0;strokeWidth=2;fillColor=#00ff00;strokeColor=#333333;gradientColor=#AAFFAA;gradientDirection=north;opacity=100.0;html=1;nl2Br=0;verticalAlign=middle;align=center;spacingLeft=0.34;spacingRight=0;whiteSpace=wrap;gliffyId=543;" parent="1" vertex="1">
           <mxGeometry x="1226.9024658203125" y="218.75" width="17" height="17" as="geometry" />
         </mxCell>
         <mxCell id="104" style="shape=rhombus;perimeter=rhombusPerimeter;shadow=0;strokeWidth=2;fillColor=#FFFFFF;strokeColor=#333333;opacity=100.0;gliffyId=566;" parent="1" vertex="1">
-          <mxGeometry x="2091.0025537109377" y="326.3" width="34" height="29" as="geometry" />
+          <mxGeometry x="2071.0025537109377" y="167.65" width="34" height="29" as="geometry" />
         </mxCell>
         <mxCell id="105" style="shape=filledEdge;strokeWidth=2;strokeColor=#000000;fillColor=none;startArrow=none;startFill=0;startSize=6;endArrow=block;endFill=1;endSize=6;rounded=0;gliffyId=568;edgeStyle=orthogonalEdgeStyle;entryX=1;entryY=0.5;entryDx=0;entryDy=0;exitX=0.5;exitY=1;exitDx=0;exitDy=0;" parent="1" source="104" target="57" edge="1">
           <mxGeometry width="100" height="100" relative="1" as="geometry">
-            <mxPoint x="2089.997548828125" y="488.3" as="targetPoint" />
+            <mxPoint x="2073.7575488281254" y="485.73" as="targetPoint" />
           </mxGeometry>
         </mxCell>
         <mxCell id="106" value="&lt;div style=&#39;width: 64.0px;height:auto;word-break: break-word;&#39;&gt;&lt;div align=&quot;left&quot;&gt;&lt;span style=&quot;font-size: 12px; font-family: Arial; white-space: pre-wrap; text-decoration: none; line-height: 14px; color: rgb(0, 0, 0);&quot;&gt;Not &lt;/span&gt;&lt;/div&gt;&lt;div align=&quot;left&quot;&gt;&lt;span style=&quot;font-size: 12px; font-family: Arial; white-space: pre-wrap; text-decoration: none; line-height: 14px; color: rgb(0, 0, 0);&quot;&gt;Last  &lt;/span&gt;&lt;/div&gt;&lt;div align=&quot;left&quot;&gt;&lt;span style=&quot;font-size: 12px; font-family: Arial; white-space: pre-wrap; text-decoration: none; line-height: 14px; color: rgb(0, 0, 0);&quot;&gt;Step&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;" style="text;html=1;nl2Br=0;html=1;nl2Br=0;verticalAlign=middle;align=left;spacingLeft=0.0;spacingRight=0;whiteSpace=wrap;gliffyId=570;" parent="1" vertex="1">
-          <mxGeometry x="2117.75" y="355.3" width="35.25" height="42" as="geometry" />
+          <mxGeometry x="2100" y="203.25" width="35.25" height="42" as="geometry" />
         </mxCell>
         <mxCell id="107" value="&lt;div style=&#39;width: 68.5px;height:auto;word-break: break-word;&#39;&gt;&lt;div align=&quot;left&quot;&gt;&lt;span style=&quot;font-size: 12px; font-family: Arial; white-space: pre-wrap; text-decoration: none; line-height: 14px; color: rgb(0, 0, 0);&quot;&gt;Last Step&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;" style="text;html=1;nl2Br=0;html=1;nl2Br=0;verticalAlign=middle;align=left;spacingLeft=0.0;spacingRight=0;whiteSpace=wrap;gliffyId=571;" parent="1" vertex="1">
-          <mxGeometry x="2125.0025537109377" y="319.00303955078124" width="71.5" height="14" as="geometry" />
+          <mxGeometry x="2105.0025537109377" y="160.05303955078125" width="71.5" height="14" as="geometry" />
         </mxCell>
         <mxCell id="110" style="shape=filledEdge;strokeWidth=2;strokeColor=#000000;fillColor=none;startArrow=none;startFill=0;startSize=6;endArrow=block;endFill=1;endSize=6;rounded=0;gliffyId=581;exitX=1.0;exitY=0.5;exitPerimeter=0;entryX=0.0;entryY=0.5;entryPerimeter=0;" parent="1" source="5" target="112" edge="1">
           <mxGeometry width="100" height="100" relative="1" as="geometry">
@@ -486,64 +472,64 @@
           <mxGeometry x="427" y="381.94696044921875" width="70" height="28" as="geometry" />
         </mxCell>
         <mxCell id="2HlbSkl1Hx2XcQlONuJN-122" value="&lt;div style=&quot;width: 93.0px;height:auto;word-break: break-word;&quot;&gt;&lt;div align=&quot;center&quot;&gt;&lt;font face=&quot;Arial&quot; color=&quot;#000000&quot;&gt;&lt;span style=&quot;white-space-collapse: preserve;&quot;&gt;Soft Body Prepare&lt;/span&gt;&lt;/font&gt;&lt;/div&gt;&lt;/div&gt;" style="shape=rect;shadow=0;strokeWidth=2;fillColor=#ffffff;strokeColor=#333333;opacity=100.0;html=1;nl2Br=0;verticalAlign=middle;align=center;spacingLeft=2.0;spacingRight=0;whiteSpace=wrap;gliffyId=48;" parent="1" vertex="1">
-          <mxGeometry x="1600" y="310.4" width="100" height="59.6" as="geometry" />
+          <mxGeometry x="1580" y="151.74999999999997" width="100" height="59.6" as="geometry" />
         </mxCell>
         <mxCell id="2HlbSkl1Hx2XcQlONuJN-123" value="&lt;div style=&quot;width: 93.0px;height:auto;word-break: break-word;&quot;&gt;&lt;div&gt;&lt;font face=&quot;Arial&quot; color=&quot;#000000&quot;&gt;&lt;span style=&quot;white-space-collapse: preserve;&quot;&gt;Soft Body &lt;/span&gt;&lt;/font&gt;&lt;span style=&quot;white-space-collapse: preserve; color: rgb(0, 0, 0); font-family: Arial; background-color: initial;&quot;&gt;Collide&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;" style="shape=rect;shadow=0;strokeWidth=2;fillColor=#FFF2CC;strokeColor=#333333;opacity=100.0;html=1;nl2Br=0;verticalAlign=middle;align=center;spacingLeft=2.0;spacingRight=0;whiteSpace=wrap;gliffyId=48;" parent="1" vertex="1">
-          <mxGeometry x="1720" y="310.4" width="110" height="59.6" as="geometry" />
+          <mxGeometry x="1700" y="151.74999999999997" width="110" height="59.6" as="geometry" />
         </mxCell>
         <mxCell id="2HlbSkl1Hx2XcQlONuJN-124" value="&lt;div style=&quot;width: 93.0px;height:auto;word-break: break-word;&quot;&gt;&lt;div align=&quot;center&quot;&gt;&lt;font face=&quot;Arial&quot; color=&quot;#000000&quot;&gt;&lt;span style=&quot;white-space-collapse: preserve;&quot;&gt;Soft Body Simulate&lt;/span&gt;&lt;/font&gt;&lt;/div&gt;&lt;/div&gt;" style="shape=rect;shadow=0;strokeWidth=2;fillColor=#FFF2CC;strokeColor=#333333;opacity=100.0;html=1;nl2Br=0;verticalAlign=middle;align=center;spacingLeft=2.0;spacingRight=0;whiteSpace=wrap;gliffyId=48;" parent="1" vertex="1">
-          <mxGeometry x="1850" y="310.4" width="100" height="59.6" as="geometry" />
+          <mxGeometry x="1830" y="151.74999999999997" width="100" height="59.6" as="geometry" />
         </mxCell>
         <mxCell id="2HlbSkl1Hx2XcQlONuJN-125" value="&lt;div style=&quot;width: 93.0px;height:auto;word-break: break-word;&quot;&gt;&lt;div align=&quot;center&quot;&gt;&lt;font face=&quot;Arial&quot; color=&quot;#000000&quot;&gt;&lt;span style=&quot;white-space-collapse: preserve;&quot;&gt;Soft Body Finalize&lt;/span&gt;&lt;/font&gt;&lt;/div&gt;&lt;/div&gt;" style="shape=rect;shadow=0;strokeWidth=2;fillColor=#ffffff;strokeColor=#333333;opacity=100.0;html=1;nl2Br=0;verticalAlign=middle;align=center;spacingLeft=2.0;spacingRight=0;whiteSpace=wrap;gliffyId=48;" parent="1" vertex="1">
-          <mxGeometry x="1970" y="310.4" width="100" height="59.6" as="geometry" />
+          <mxGeometry x="1950" y="151.74999999999997" width="100" height="59.6" as="geometry" />
         </mxCell>
         <mxCell id="2HlbSkl1Hx2XcQlONuJN-127" value="" style="endArrow=block;html=1;rounded=0;exitX=1;exitY=0.5;exitDx=0;exitDy=0;strokeWidth=2;strokeColor=#000000;endFill=1;" parent="1" source="2HlbSkl1Hx2XcQlONuJN-122" target="2HlbSkl1Hx2XcQlONuJN-123" edge="1">
           <mxGeometry width="50" height="50" relative="1" as="geometry">
-            <mxPoint x="2230" y="277.50000000000006" as="sourcePoint" />
-            <mxPoint x="2252.25" y="277.50000000000006" as="targetPoint" />
+            <mxPoint x="2210" y="118.85000000000005" as="sourcePoint" />
+            <mxPoint x="2232.25" y="118.85000000000005" as="targetPoint" />
           </mxGeometry>
         </mxCell>
         <mxCell id="2HlbSkl1Hx2XcQlONuJN-128" value="" style="endArrow=block;html=1;rounded=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;exitX=1;exitY=0.5;exitDx=0;exitDy=0;strokeWidth=2;strokeColor=#000000;endFill=1;" parent="1" source="2HlbSkl1Hx2XcQlONuJN-123" target="2HlbSkl1Hx2XcQlONuJN-124" edge="1">
           <mxGeometry width="50" height="50" relative="1" as="geometry">
-            <mxPoint x="1708" y="350" as="sourcePoint" />
-            <mxPoint x="1730" y="350" as="targetPoint" />
+            <mxPoint x="1688" y="191.35" as="sourcePoint" />
+            <mxPoint x="1710" y="191.35" as="targetPoint" />
           </mxGeometry>
         </mxCell>
         <mxCell id="2HlbSkl1Hx2XcQlONuJN-129" value="" style="endArrow=block;html=1;rounded=0;exitX=1;exitY=0.5;exitDx=0;exitDy=0;strokeWidth=2;strokeColor=#000000;endFill=1;" parent="1" source="2HlbSkl1Hx2XcQlONuJN-124" target="2HlbSkl1Hx2XcQlONuJN-125" edge="1">
           <mxGeometry width="50" height="50" relative="1" as="geometry">
-            <mxPoint x="1718" y="360" as="sourcePoint" />
-            <mxPoint x="1740" y="360" as="targetPoint" />
+            <mxPoint x="1698" y="201.35" as="sourcePoint" />
+            <mxPoint x="1720" y="201.35" as="targetPoint" />
           </mxGeometry>
         </mxCell>
         <mxCell id="2HlbSkl1Hx2XcQlONuJN-130" value="" style="endArrow=block;html=1;rounded=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;exitX=1;exitY=0.5;exitDx=0;exitDy=0;strokeWidth=2;strokeColor=#000000;endFill=1;" parent="1" source="2HlbSkl1Hx2XcQlONuJN-125" target="104" edge="1">
           <mxGeometry width="50" height="50" relative="1" as="geometry">
-            <mxPoint x="1728" y="370" as="sourcePoint" />
-            <mxPoint x="1750" y="370" as="targetPoint" />
+            <mxPoint x="1708" y="211.35" as="sourcePoint" />
+            <mxPoint x="1730" y="211.35" as="targetPoint" />
           </mxGeometry>
         </mxCell>
         <mxCell id="2HlbSkl1Hx2XcQlONuJN-134" value="&lt;div style=&#39;width: 13.32px;height:auto;word-break: break-word;&#39;&gt;&lt;div align=&quot;center&quot;&gt;&lt;span style=&quot;font-size: 12px; font-family: Arial; white-space: pre-wrap; text-decoration: none; line-height: 14px; color: rgb(0, 0, 0);&quot;&gt;P&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;" style="shape=rect;shadow=0;strokeWidth=2;fillColor=#00ff00;strokeColor=#333333;gradientColor=#AAFFAA;gradientDirection=north;opacity=100.0;html=1;nl2Br=0;verticalAlign=middle;align=center;spacingLeft=0.34;spacingRight=0;whiteSpace=wrap;gliffyId=191;" parent="1" vertex="1">
-          <mxGeometry x="1600" y="371.1" width="17" height="17" as="geometry" />
+          <mxGeometry x="1580" y="212.45000000000002" width="17" height="17" as="geometry" />
         </mxCell>
         <mxCell id="2HlbSkl1Hx2XcQlONuJN-136" value="&lt;div style=&#39;width: 13.32px;height:auto;word-break: break-word;&#39;&gt;&lt;div align=&quot;center&quot;&gt;&lt;span style=&quot;font-size: 12px; font-family: Arial; white-space: pre-wrap; text-decoration: none; line-height: 14px; color: rgb(0, 0, 0);&quot;&gt;P&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;" style="shape=rect;shadow=0;strokeWidth=2;fillColor=#ff0000;strokeColor=#333333;gradientColor=#FFAAAA;gradientDirection=north;opacity=100.0;html=1;nl2Br=0;verticalAlign=middle;align=center;spacingLeft=0.34;spacingRight=0;whiteSpace=wrap;gliffyId=200;" parent="1" vertex="1">
-          <mxGeometry x="1970" y="370" width="17" height="17" as="geometry" />
+          <mxGeometry x="1950" y="211.35" width="17" height="17" as="geometry" />
         </mxCell>
         <mxCell id="2HlbSkl1Hx2XcQlONuJN-137" value="&lt;div style=&#39;width: 13.32px;height:auto;word-break: break-word;&#39;&gt;&lt;div align=&quot;center&quot;&gt;&lt;span style=&quot;font-size: 12px; font-family: Arial; white-space: pre-wrap; text-decoration: none; line-height: 14px; color: rgb(0, 0, 0);&quot;&gt;V&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;" style="shape=rect;shadow=0;strokeWidth=2;fillColor=#ff0000;strokeColor=#333333;gradientColor=#FFAAAA;gradientDirection=north;opacity=100.0;html=1;nl2Br=0;verticalAlign=middle;align=center;spacingLeft=0.34;spacingRight=0;whiteSpace=wrap;gliffyId=198;" parent="1" vertex="1">
-          <mxGeometry x="1987" y="370" width="17" height="17" as="geometry" />
+          <mxGeometry x="1967" y="211.35" width="17" height="17" as="geometry" />
         </mxCell>
         <mxCell id="2HlbSkl1Hx2XcQlONuJN-138" value="&lt;div style=&#39;width: 13.32px;height:auto;word-break: break-word;&#39;&gt;&lt;div align=&quot;center&quot;&gt;&lt;span style=&quot;font-size: 12px; font-family: Arial; white-space: pre-wrap; text-decoration: none; line-height: 14px; color: rgb(0, 0, 0);&quot;&gt;P&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;" style="shape=rect;shadow=0;strokeWidth=2;fillColor=#00ff00;strokeColor=#333333;gradientColor=#AAFFAA;gradientDirection=north;opacity=100.0;html=1;nl2Br=0;verticalAlign=middle;align=center;spacingLeft=0.34;spacingRight=0;whiteSpace=wrap;gliffyId=191;" parent="1" vertex="1">
-          <mxGeometry x="1720" y="370" width="17" height="17" as="geometry" />
+          <mxGeometry x="1700" y="211.35" width="17" height="17" as="geometry" />
         </mxCell>
         <mxCell id="2HlbSkl1Hx2XcQlONuJN-139" value="&lt;div style=&#39;width: 13.32px;height:auto;word-break: break-word;&#39;&gt;&lt;div align=&quot;center&quot;&gt;&lt;span style=&quot;font-size: 12px; font-family: Arial; white-space: pre-wrap; text-decoration: none; line-height: 14px; color: rgb(0, 0, 0);&quot;&gt;V&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;" style="shape=rect;shadow=0;strokeWidth=2;fillColor=#00ff00;strokeColor=#333333;gradientColor=#AAFFAA;gradientDirection=north;opacity=100.0;html=1;nl2Br=0;verticalAlign=middle;align=center;spacingLeft=0.34;spacingRight=0;whiteSpace=wrap;gliffyId=194;" parent="1" vertex="1">
-          <mxGeometry x="1737.6599999999999" y="370" width="17" height="17" as="geometry" />
+          <mxGeometry x="1717.6599999999999" y="211.35" width="17" height="17" as="geometry" />
         </mxCell>
         <mxCell id="2HlbSkl1Hx2XcQlONuJN-140" value="&lt;div style=&#39;width: 13.32px;height:auto;word-break: break-word;&#39;&gt;&lt;div align=&quot;center&quot;&gt;&lt;span style=&quot;font-size: 12px; font-family: Arial; white-space: pre-wrap; text-decoration: none; line-height: 14px; color: rgb(0, 0, 0);&quot;&gt;V&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;" style="shape=rect;shadow=0;strokeWidth=2;fillColor=#ff0000;strokeColor=#333333;gradientColor=#FFAAAA;gradientDirection=north;opacity=100.0;html=1;nl2Br=0;verticalAlign=middle;align=center;spacingLeft=0.34;spacingRight=0;whiteSpace=wrap;gliffyId=198;" parent="1" vertex="1">
-          <mxGeometry x="1850" y="371.1" width="17" height="17" as="geometry" />
+          <mxGeometry x="1830" y="212.45000000000002" width="17" height="17" as="geometry" />
         </mxCell>
         <mxCell id="1HMQW9uxuVFfJUHc01B5-122" value="&lt;div style=&#39;width: 13.32px;height:auto;word-break: break-word;&#39;&gt;&lt;div align=&quot;center&quot;&gt;&lt;span style=&quot;font-size: 12px; font-family: Arial; white-space: pre-wrap; text-decoration: none; line-height: 14px; color: rgb(0, 0, 0);&quot;&gt;A&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;" style="shape=rect;shadow=0;strokeWidth=2;fillColor=#ff9900;strokeColor=#333333;gradientColor=#FFFFAA;gradientDirection=north;opacity=100.0;html=1;nl2Br=0;verticalAlign=middle;align=center;spacingLeft=0.34;spacingRight=0;whiteSpace=wrap;gliffyId=438;" parent="1" vertex="1">
-          <mxGeometry x="2004.0040594482423" y="370" width="17" height="17" as="geometry" />
+          <mxGeometry x="1984.0040594482423" y="211.35" width="17" height="17" as="geometry" />
         </mxCell>
         <mxCell id="1HMQW9uxuVFfJUHc01B5-123" value="&lt;div style=&#39;width: 13.32px;height:auto;word-break: break-word;&#39;&gt;&lt;div align=&quot;center&quot;&gt;&lt;span style=&quot;font-size: 12px; font-family: Arial; white-space: pre-wrap; text-decoration: none; line-height: 14px; color: rgb(0, 0, 0);&quot;&gt;A&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;" style="shape=rect;shadow=0;strokeWidth=2;fillColor=#ff0000;strokeColor=#333333;gradientColor=#FFAAAA;gradientDirection=north;opacity=100.0;html=1;nl2Br=0;verticalAlign=middle;align=center;spacingLeft=0.34;spacingRight=0;whiteSpace=wrap;gliffyId=341;" parent="1" vertex="1">
-          <mxGeometry x="2021.0040594482423" y="370" width="17" height="17" as="geometry" />
+          <mxGeometry x="2001.0040594482423" y="211.35" width="17" height="17" as="geometry" />
         </mxCell>
       </root>
     </mxGraphModel>

File diff suppressed because it is too large
+ 0 - 0
Docs/PhysicsSystemUpdate.svg


+ 6 - 6
Jolt/Physics/PhysicsSystem.cpp

@@ -378,9 +378,8 @@ EPhysicsUpdateError PhysicsSystem::Update(float inDeltaTime, int inCollisionStep
 				{
 					context.mPhysicsSystem->JobBodySetIslandIndex();
 
-					if (step.mStartNextStep.IsValid())
-						step.mStartNextStep.RemoveDependency();
-				}, 1); // depends on: finalize islands
+					JobHandle::sRemoveDependencies(step.mSolvePositionConstraints);
+				}, 2); // depends on: finalize islands, finish building jobs
 
 			// Job to start the next collision step
 			if (!is_last_step)
@@ -422,7 +421,7 @@ EPhysicsUpdateError PhysicsSystem::Update(float inDeltaTime, int inCollisionStep
 							// Kick the step listeners job first
 							JobHandle::sRemoveDependencies(next_step->mStepListeners);
 						}
-					}, 4); // depends on: update soft bodies, body set island index, contact removed callbacks, finish building the previous step
+					}, 3); // depends on: update soft bodies, contact removed callbacks, finish building the previous step
 			}
 
 			// This job will solve the velocity constraints
@@ -499,10 +498,11 @@ EPhysicsUpdateError PhysicsSystem::Update(float inDeltaTime, int inCollisionStep
 						// Kick the next step
 						if (step.mSoftBodyPrepare.IsValid())
 							step.mSoftBodyPrepare.RemoveDependency();
-					}, 2); // depends on: resolve ccd contacts, finish building jobs.
+					}, 3); // depends on: resolve ccd contacts, body set island index, finish building jobs.
 
-			// Unblock previous job.
+			// Unblock previous jobs.
 			step.mResolveCCDContacts.RemoveDependency();
+			step.mBodySetIslandIndex.RemoveDependency();
 
 			// The soft body prepare job will create other jobs if needed
 			step.mSoftBodyPrepare = inJobSystem->CreateJob("SoftBodyPrepare", cColorSoftBodyPrepare, [&context, &step]()

Some files were not shown because too many files changed in this diff