@series-inc/rundot-syncplay 6.0.0-rc.28 → 6.0.0-rc.29

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.
@@ -23,7 +23,7 @@ export const physicsProfileWasmMetadata = Object.freeze({
23
23
  "sourceHash": "13bc7e6c473b9a773bbb0f77d1c2126df59a074759ebb5efb90b8dde1ff4d10a",
24
24
  "wasmSha256": "d398c126e4da59324d6e28f14132173a9f980f9fc429f632baffacbae4744fef",
25
25
  "artifact": "profile",
26
- "packageVersion": "6.0.0-rc.28",
26
+ "packageVersion": "6.0.0-rc.29",
27
27
  "compilerFlags": [
28
28
  "-std=c++20",
29
29
  "-O3",
@@ -23,7 +23,7 @@ export const physicsWasmMetadata = Object.freeze({
23
23
  "sourceHash": "4bb02a55da437ff3075d5350d48f319bd8b89a6dd31d9a34d9b0cb3677ed4914",
24
24
  "wasmSha256": "76ea5a82d4e84d0e3bc3fd93dd54992b54c09614f7024e4f8b5bf91445db1955",
25
25
  "artifact": "production",
26
- "packageVersion": "6.0.0-rc.28",
26
+ "packageVersion": "6.0.0-rc.29",
27
27
  "compilerFlags": [
28
28
  "-std=c++20",
29
29
  "-O3",
@@ -50,7 +50,7 @@ export const physics2dWasmMetadata = Object.freeze({
50
50
  "sourceHash": "faa090a03a6fddaf79c704fb1d76f810955ff35597449c8cec9541a75905a37e",
51
51
  "wasmSha256": "49cb90541deed40f5fff1015bb578e13ec9a793d51931c1227e3e5a11bbfa3f7",
52
52
  "artifact": "production",
53
- "packageVersion": "6.0.0-rc.28",
53
+ "packageVersion": "6.0.0-rc.29",
54
54
  "compilerFlags": [
55
55
  "-std=c++20",
56
56
  "-O3",
@@ -2209,6 +2209,71 @@ function sweepPhysicsKcc3D(physics, previous, candidate, ignoredBodyIds, frame,
2209
2209
  assertKccCollisionFiltersUnchanged(collisionFilters, filterStateBefore);
2210
2210
  return { ...candidate, corrected: false, slid: false, swept: false, correctionCount: 0, queryCount, collisionFilterCalls, collisionFilterRejectedHits };
2211
2211
  }
2212
+ const APERTURE_CONTAINMENT_TOLERANCE = 0.05;
2213
+ function resolveKccHostBodyId(physics, ref) {
2214
+ if (ref === undefined || ref === null)
2215
+ return undefined;
2216
+ if (typeof ref === "bigint")
2217
+ return ref;
2218
+ if (typeof ref === "number")
2219
+ return BigInt(ref);
2220
+ if (typeof ref === "string") {
2221
+ try {
2222
+ return BigInt(ref);
2223
+ }
2224
+ catch {
2225
+ return undefined;
2226
+ }
2227
+ }
2228
+ if (typeof ref === "object") {
2229
+ if (physics && typeof physics.resolveBody === "function") {
2230
+ try {
2231
+ const handle = physics.resolveBody(ref);
2232
+ if (handle && typeof handle.id === "bigint")
2233
+ return handle.id;
2234
+ }
2235
+ catch {
2236
+ // Fall through
2237
+ }
2238
+ }
2239
+ if ("id" in ref) {
2240
+ const id = ref.id;
2241
+ if (typeof id === "bigint")
2242
+ return id;
2243
+ if (typeof id === "number")
2244
+ return BigInt(id);
2245
+ if (typeof id === "string") {
2246
+ try {
2247
+ return BigInt(id);
2248
+ }
2249
+ catch {
2250
+ return undefined;
2251
+ }
2252
+ }
2253
+ if (typeof id === "object" && id !== null && physics && typeof physics.resolveBody === "function") {
2254
+ try {
2255
+ const handle = physics.resolveBody(id);
2256
+ if (handle && typeof handle.id === "bigint")
2257
+ return handle.id;
2258
+ }
2259
+ catch {
2260
+ // Fall through
2261
+ }
2262
+ }
2263
+ }
2264
+ if ("key" in ref && physics && typeof physics.resolveBody === "function") {
2265
+ try {
2266
+ const handle = physics.resolveBody(ref);
2267
+ if (handle && typeof handle.id === "bigint")
2268
+ return handle.id;
2269
+ }
2270
+ catch {
2271
+ // Fall through
2272
+ }
2273
+ }
2274
+ }
2275
+ return undefined;
2276
+ }
2212
2277
  function kccCapsuleFitsAperture(x, y, z, geometry, portalEnd) {
2213
2278
  const rotNorm = quatNormalizePure(portalEnd.rotation);
2214
2279
  const localCenter = invRotateVec3Pure(rotNorm, subVec3Pure({ x, y, z }, portalEnd.position));
@@ -2220,8 +2285,8 @@ function kccCapsuleFitsAperture(x, y, z, geometry, portalEnd) {
2220
2285
  const extX = Math.abs(localUp.x) * halfSeg + geometry.radius + skin;
2221
2286
  const extY = Math.abs(localUp.y) * halfSeg + geometry.radius + skin;
2222
2287
  const extZ = Math.abs(localUp.z) * halfSeg + geometry.radius + skin;
2223
- const fitsOpeningX = Math.abs(localCenter.x) + extX <= halfW;
2224
- const fitsOpeningY = Math.abs(localCenter.y) + extY <= halfH;
2288
+ const fitsOpeningX = Math.abs(localCenter.x) + extX <= halfW + APERTURE_CONTAINMENT_TOLERANCE;
2289
+ const fitsOpeningY = Math.abs(localCenter.y) + extY <= halfH + APERTURE_CONTAINMENT_TOLERANCE;
2225
2290
  const inCorridor = Math.abs(localCenter.z) <= Math.max(1.0, extZ + 0.5);
2226
2291
  return fitsOpeningX && fitsOpeningY && inCorridor;
2227
2292
  }
@@ -2250,9 +2315,8 @@ function physicsOverlapsKcc(physics, x, y, z, context) {
2250
2315
  continue;
2251
2316
  for (const end of [pair.portalA, pair.portalB]) {
2252
2317
  if (end.hostBodyId !== undefined) {
2253
- const hostId = typeof end.hostBodyId === "object" && end.hostBodyId !== null && "id" in end.hostBodyId
2254
- ? end.hostBodyId.id : end.hostBodyId;
2255
- if (hostId === bodyId || BigInt(hostId) === BigInt(bodyId)) {
2318
+ const hostId = resolveKccHostBodyId(physics, end.hostBodyId);
2319
+ if (hostId !== undefined && (hostId === bodyId || hostId === BigInt(bodyId))) {
2256
2320
  if (kccCapsuleFitsAperture(x, y, z, geometry, end)) {
2257
2321
  return false;
2258
2322
  }
@@ -2293,15 +2357,14 @@ function filterKccHits(physics, hits, ignoredBodyIds, collisionFilters, context,
2293
2357
  continue;
2294
2358
  for (const end of [pair.portalA, pair.portalB]) {
2295
2359
  if (end.hostBodyId !== undefined) {
2296
- const hostId = typeof end.hostBodyId === "object" && end.hostBodyId !== null && "id" in end.hostBodyId
2297
- ? end.hostBodyId.id : end.hostBodyId;
2298
- if (hostId === hit.bodyId || BigInt(hostId) === BigInt(hit.bodyId)) {
2360
+ const hostId = resolveKccHostBodyId(physics, end.hostBodyId);
2361
+ if (hostId !== undefined && (hostId === hit.bodyId || hostId === BigInt(hit.bodyId))) {
2299
2362
  const rotNorm = quatNormalizePure(end.rotation);
2300
2363
  const localHit = invRotateVec3Pure(rotNorm, subVec3Pure(hit.point, end.position));
2301
2364
  const halfW = end.opening.width * 0.5;
2302
2365
  const halfH = end.opening.height * 0.5;
2303
- if (Math.abs(localHit.x) <= halfW &&
2304
- Math.abs(localHit.y) <= halfH &&
2366
+ if (Math.abs(localHit.x) <= halfW + APERTURE_CONTAINMENT_TOLERANCE &&
2367
+ Math.abs(localHit.y) <= halfH + APERTURE_CONTAINMENT_TOLERANCE &&
2305
2368
  kccCapsuleFitsAperture(x, y, z, geometry, end)) {
2306
2369
  isHostApertureHit = true;
2307
2370
  break;
@@ -953,6 +953,7 @@ function defaultInertia(shape, mass) {
953
953
  const PORTAL_HOST_LAYER_BASE = 24;
954
954
  const PORTAL_HOST_LAYER_COUNT = 7;
955
955
  const ALL_PORTAL_HOST_LAYERS = (0x7f << PORTAL_HOST_LAYER_BASE) >>> 0;
956
+ const APERTURE_CONTAINMENT_TOLERANCE = 0.05;
956
957
  function encodeBody(body) {
957
958
  const values = new Float64Array(bodyStride);
958
959
  const kind = body.kind ?? 'dynamic';
@@ -2052,7 +2053,7 @@ class PortalSimulatorManager {
2052
2053
  w: this.scratchPoses[i * 7 + 6],
2053
2054
  };
2054
2055
  const ext = computeOrientedExtents(shapeKind, bVals, bodyOri, entryRotNorm);
2055
- if (Math.abs(localPos.x) + ext.extX <= halfW && Math.abs(localPos.y) + ext.extY <= halfH) {
2056
+ if (Math.abs(localPos.x) + ext.extX <= halfW + APERTURE_CONTAINMENT_TOLERANCE && Math.abs(localPos.y) + ext.extY <= halfH + APERTURE_CONTAINMENT_TOLERANCE) {
2056
2057
  if (localPos.z >= -ext.extZ * 2.5 && localPos.z <= trackingRadius) {
2057
2058
  desiredSuppressed.set(bodyId, (desiredSuppressed.get(bodyId) ?? 0) | hostLayer);
2058
2059
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@series-inc/rundot-syncplay",
3
- "version": "6.0.0-rc.28",
3
+ "version": "6.0.0-rc.29",
4
4
  "description": "Kinetix orchestration, rollback, replay, late-join, and deterministic networking for RUN.game",
5
5
  "repository": {
6
6
  "type": "git",