@series-inc/rundot-syncplay 6.0.0-rc.7 → 6.0.0-rc.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2861,9 +2861,10 @@ public:
2861
2861
  }
2862
2862
 
2863
2863
  template <typename Callback>
2864
- void forEachPair(const Body*, Callback&& callback) {
2864
+ void forEachPair(const Body* bodies, Callback&& callback) {
2865
2865
  if (root == -1) return;
2866
2866
  for (std::uint32_t bodyIndex = 0; bodyIndex < bodyCount; bodyIndex += 1) {
2867
+ const bool bodyStatic = bodies && !bodies[bodyIndex].dynamic && !bodies[bodyIndex].kinematic;
2867
2868
  const BroadphaseBounds actualLeafBounds = actualBounds[bodyIndex];
2868
2869
  std::uint32_t matchCount = 0;
2869
2870
  queryStackCount = 1;
@@ -2874,6 +2875,7 @@ public:
2874
2875
  if (!boundsOverlap(actualLeafBounds, node.bounds)) continue;
2875
2876
  if (node.leaf) {
2876
2877
  if (node.bodyIndex > bodyIndex
2878
+ && !(bodyStatic && bodies && !bodies[node.bodyIndex].dynamic && !bodies[node.bodyIndex].kinematic)
2877
2879
  && boundsOverlap(actualLeafBounds, actualBounds[node.bodyIndex])) {
2878
2880
  queryMatches[matchCount++] = node.bodyIndex;
2879
2881
  }
@@ -2887,12 +2889,13 @@ public:
2887
2889
  }
2888
2890
  }
2889
2891
 
2890
- void collectPairs() {
2892
+ void collectPairs(const Body* bodies = nullptr) {
2891
2893
  pairCount = 0;
2892
2894
  pairOverflow = false;
2893
2895
  pairsReady = true;
2894
2896
  if (root == -1) return;
2895
2897
  for (std::uint32_t bodyIndex = 0; bodyIndex < bodyCount; bodyIndex += 1) {
2898
+ const bool bodyStatic = bodies && !bodies[bodyIndex].dynamic && !bodies[bodyIndex].kinematic;
2896
2899
  const BroadphaseBounds actualLeafBounds = nodes[leafNodes[bodyIndex]].bounds;
2897
2900
  const std::uint32_t pairStart = pairCount;
2898
2901
  queryStackCount = 1;
@@ -2903,6 +2906,7 @@ public:
2903
2906
  if (!boundsOverlap(actualLeafBounds, node.bounds)) continue;
2904
2907
  if (node.leaf) {
2905
2908
  if (node.bodyIndex > bodyIndex
2909
+ && !(bodyStatic && bodies && !bodies[node.bodyIndex].dynamic && !bodies[node.bodyIndex].kinematic)
2906
2910
  && boundsOverlap(actualLeafBounds, nodes[leafNodes[node.bodyIndex]].bounds)) {
2907
2911
  if (pairCount >= pairCapacity) {
2908
2912
  pairOverflow = true;
@@ -3342,9 +3346,11 @@ void forEachSweepPair(SolverOperation& operation, const Body* bodies, std::uint3
3342
3346
  prepareBroadphase(operation, bodies, bodyCount);
3343
3347
  for (std::uint32_t leftOrder = 0; leftOrder < bodyCount; leftOrder += 1) {
3344
3348
  const std::uint32_t left = operation.storage.broadphaseOrder[leftOrder];
3349
+ const bool leftStatic = !bodies[left].dynamic && !bodies[left].kinematic;
3345
3350
  for (std::uint32_t rightOrder = leftOrder + 1; rightOrder < bodyCount; rightOrder += 1) {
3346
3351
  const std::uint32_t right = operation.storage.broadphaseOrder[rightOrder];
3347
3352
  if (operation.storage.broadphaseBounds[right].minX > operation.storage.broadphaseBounds[left].maxX) break;
3353
+ if (leftStatic && !bodies[right].dynamic && !bodies[right].kinematic) continue;
3348
3354
  if (boundsOverlap(operation.storage.broadphaseBounds[left], operation.storage.broadphaseBounds[right])) {
3349
3355
  callback(std::min(left, right), std::max(left, right));
3350
3356
  }
@@ -3358,9 +3364,11 @@ void collectSweepPairs(SolverOperation& operation, const Body* bodies, std::uint
3358
3364
  operation.storage.broadphasePairOverflow = false;
3359
3365
  for (std::uint32_t leftOrder = 0; leftOrder < bodyCount; leftOrder += 1) {
3360
3366
  const std::uint32_t left = operation.storage.broadphaseOrder[leftOrder];
3367
+ const bool leftStatic = !bodies[left].dynamic && !bodies[left].kinematic;
3361
3368
  for (std::uint32_t rightOrder = leftOrder + 1; rightOrder < bodyCount; rightOrder += 1) {
3362
3369
  const std::uint32_t right = operation.storage.broadphaseOrder[rightOrder];
3363
3370
  if (operation.storage.broadphaseBounds[right].minX > operation.storage.broadphaseBounds[left].maxX) break;
3371
+ if (leftStatic && !bodies[right].dynamic && !bodies[right].kinematic) continue;
3364
3372
  if (!boundsOverlap(operation.storage.broadphaseBounds[left], operation.storage.broadphaseBounds[right])) continue;
3365
3373
  if (operation.storage.broadphasePairCount >= operation.storage.broadphasePairFirst.size()) {
3366
3374
  operation.storage.broadphasePairOverflow = true;
@@ -7435,6 +7443,7 @@ void resolveSoAContacts(SolverOperation& operation, Body* bodies, std::uint32_t
7435
7443
  std::uint32_t preparedBegin,
7436
7444
  std::uint32_t preparedEnd) {
7437
7445
  if (initialize && collisionDisabled(operation, first, second)) return;
7446
+ if (initialize && !bodies[first].dynamic && !bodies[first].kinematic && !bodies[second].dynamic && !bodies[second].kinematic) return;
7438
7447
  if (!solveVelocity) {
7439
7448
  if (resolveContactPair(operation, bodies[first], bodies[second], options,
7440
7449
  nullptr, nullptr, nullptr, nullptr, nullptr, true,
@@ -7683,7 +7692,7 @@ void resolveSoAContacts(SolverOperation& operation, Body* bodies, std::uint32_t
7683
7692
  if (beginSubstep) {
7684
7693
  operation.storage.broadphaseTree->ensure(operation, bodies, bodyCount);
7685
7694
  if (!operation.storage.broadphaseTree->pairsAreReady()) {
7686
- operation.storage.broadphaseTree->collectPairs();
7695
+ operation.storage.broadphaseTree->collectPairs(bodies);
7687
7696
  }
7688
7697
  }
7689
7698
  for (std::uint32_t iteration = 0; iteration < velocityIterations; iteration += 1) {