@series-inc/rundot-syncplay 6.0.0-rc.23 → 6.0.0-rc.24

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.
@@ -3077,6 +3077,14 @@ public:
3077
3077
  return pairsReady;
3078
3078
  }
3079
3079
 
3080
+ bool isInitialized() const noexcept {
3081
+ return initialized;
3082
+ }
3083
+
3084
+ std::uint32_t count() const noexcept {
3085
+ return bodyCount;
3086
+ }
3087
+
3080
3088
  std::uint64_t retainedBytes() const noexcept {
3081
3089
  return static_cast<std::uint64_t>(actualBounds.capacity()) * sizeof(BroadphaseBounds)
3082
3090
  + static_cast<std::uint64_t>(queryMatches.capacity()) * sizeof(std::uint32_t)
@@ -4952,6 +4960,23 @@ void solveAccumulatedPointConstraint(
4952
4960
  }
4953
4961
  }
4954
4962
 
4963
+ inline bool isJointActivelyDriven(const Joint& joint) noexcept {
4964
+ if (joint.kind == JointKind::Motor) {
4965
+ if ((joint.flags & 32768u) != 0) {
4966
+ if (joint.maxLinearMotor > 0.0 && (joint.motorLinearX != 0.0 || joint.motorLinearY != 0.0 || joint.motorLinearZ != 0.0)) return true;
4967
+ }
4968
+ if ((joint.flags & 65536u) != 0) {
4969
+ if (joint.maxAngularMotor > 0.0 && (joint.motorAngularX != 0.0 || joint.motorAngularY != 0.0 || joint.motorAngularZ != 0.0)) return true;
4970
+ }
4971
+ if (joint.maxMotor > 0.0 && joint.motorSpeed != 0.0) return true;
4972
+ }
4973
+ if ((joint.kind == JointKind::Revolute || joint.kind == JointKind::Prismatic) && joint.maxMotor > 0.0 && joint.motorSpeed != 0.0) return true;
4974
+ if (joint.kind == JointKind::Wheel && joint.maxMotor > 0.0 && joint.motorSpeed != 0.0) return true;
4975
+ if (joint.kind == JointKind::Spherical && (joint.flags & 65536u) != 0 && joint.maxAngularMotor > 0.0
4976
+ && (joint.motorAngularX != 0.0 || joint.motorAngularY != 0.0 || joint.motorAngularZ != 0.0)) return true;
4977
+ return false;
4978
+ }
4979
+
4955
4980
  void resolveJoints(SolverOperation& operation, Body* bodies, std::uint32_t bodyCount, const Joint* joints,
4956
4981
  std::uint32_t jointCount, const StepOptions& options) {
4957
4982
  if (jointCount == 0) return;
@@ -4969,6 +4994,11 @@ void resolveJoints(SolverOperation& operation, Body* bodies, std::uint32_t bodyC
4969
4994
  if (joint.bodyA >= bodyCount || joint.bodyB >= bodyCount || joint.bodyA == joint.bodyB) continue;
4970
4995
  Body& a = bodies[joint.bodyA];
4971
4996
  Body& b = bodies[joint.bodyB];
4997
+ if (!isJointActivelyDriven(joint)
4998
+ && (a.sleeping || (!a.dynamic && !a.kinematic))
4999
+ && (b.sleeping || (!b.dynamic && !b.kinematic))) {
5000
+ continue;
5001
+ }
4972
5002
  if (joint.kind == JointKind::Distance) {
4973
5003
  const Vec3 worldA = worldJointAnchor(a, joint.anchorAX, joint.anchorAY, joint.anchorAZ);
4974
5004
  const Vec3 worldB = worldJointAnchor(b, joint.anchorBX, joint.anchorBY, joint.anchorBZ);
@@ -7145,11 +7175,8 @@ std::int32_t runRaycastQuery(SolverOperation& operation,
7145
7175
  if (static_cast<std::int32_t>(queryData[20]) == static_cast<std::int32_t>(index)
7146
7176
  || !queryBodyAllowed(operation.storage.soaBodies[index], queryData)) continue;
7147
7177
  const Body& target = operation.storage.soaBodies[index];
7148
- if (target.shape != ShapeKind::Mesh && target.shape != ShapeKind::Hull
7149
- && target.shape != ShapeKind::Heightfield) {
7150
- const BroadphaseBounds targetBounds = queryProxyBounds(operation, target);
7151
- if (!boundsOverlap(rayBounds, targetBounds)) continue;
7152
- }
7178
+ const BroadphaseBounds targetBounds = queryProxyBounds(operation, target);
7179
+ if (!boundsOverlap(rayBounds, targetBounds)) continue;
7153
7180
  appendQueryHit(operation, index, rayBody(operation, target, origin, direction, maxDistance));
7154
7181
  }
7155
7182
  finalizeQueryResults(operation, false);
@@ -7202,7 +7229,7 @@ std::int32_t runOverlapQuery(SolverOperation& operation,
7202
7229
  BroadphaseBounds bounds;
7203
7230
  };
7204
7231
  std::vector<ActiveCompoundChild> activeCompoundChildren;
7205
- if (cast && target.shape == ShapeKind::Compound) {
7232
+ if (target.shape == ShapeKind::Compound) {
7206
7233
  for (std::uint32_t child = 0; child < compoundChildCount(operation, target); child += 1) {
7207
7234
  const Body childBody = compoundChildBody(operation, target, child);
7208
7235
  const BroadphaseBounds childBounds = queryProxyBounds(operation, childBody);
@@ -7213,13 +7240,13 @@ std::int32_t runOverlapQuery(SolverOperation& operation,
7213
7240
  if (activeCompoundChildren.empty()) continue;
7214
7241
  }
7215
7242
  auto collisionAt = [&](const Body& moved) -> Collision {
7216
- if (cast && target.shape == ShapeKind::Compound) {
7243
+ if (target.shape == ShapeKind::Compound) {
7217
7244
  const BroadphaseBounds boundsB = queryProxyBounds(operation, moved);
7218
7245
  Collision best;
7219
7246
  std::int32_t bestChild = -1;
7220
7247
  for (const auto& item : activeCompoundChildren) {
7221
7248
  if (!boundsOverlap(item.bounds, boundsB)) continue;
7222
- const Collision candidate = collide(operation, moved, item.body);
7249
+ const Collision candidate = flipCollision(collide(operation, item.body, moved));
7223
7250
  if (candidate.hit) {
7224
7251
  if (!best.hit || candidate.penetration > best.penetration) {
7225
7252
  best = candidate;
@@ -8095,6 +8122,17 @@ void wakeJointComponents(SolverOperation& operation, Body* bodies,
8095
8122
  operation.storage.sleepHasKinematic[sleepFind(operation, index)] = 1;
8096
8123
  }
8097
8124
  }
8125
+ for (std::uint32_t index = 0; index < jointCount; ++index) {
8126
+ const Joint& joint = joints[index];
8127
+ if (joint.bodyA < bodyCount && joint.bodyB < bodyCount && isJointActivelyDriven(joint)) {
8128
+ if (bodies[joint.bodyA].dynamic) {
8129
+ operation.storage.sleepHasKinematic[sleepFind(operation, joint.bodyA)] = 1;
8130
+ }
8131
+ if (bodies[joint.bodyB].dynamic) {
8132
+ operation.storage.sleepHasKinematic[sleepFind(operation, joint.bodyB)] = 1;
8133
+ }
8134
+ }
8135
+ }
8098
8136
  for (std::uint32_t index = 0; index < bodyCount; ++index) {
8099
8137
  Body& body = bodies[index];
8100
8138
  if (body.dynamic && body.sleeping
@@ -8174,6 +8212,16 @@ void updateSleepingStates(SolverOperation& operation,
8174
8212
  operation.storage.sleepHasStaticAnchor[joint.bodyB] = true;
8175
8213
  }
8176
8214
  }
8215
+ if (isJointActivelyDriven(joint)) {
8216
+ if (dynA) {
8217
+ operation.storage.sleepCanSleep[joint.bodyA] = false;
8218
+ bodies[joint.bodyA].sleepTime = 0.0;
8219
+ }
8220
+ if (dynB) {
8221
+ operation.storage.sleepCanSleep[joint.bodyB] = false;
8222
+ bodies[joint.bodyB].sleepTime = 0.0;
8223
+ }
8224
+ }
8177
8225
  }
8178
8226
  for (const auto& connection : connections) {
8179
8227
  if (connection[0] < bodyCount && connection[1] < bodyCount) {