@series-inc/rundot-syncplay 6.0.0-rc.25 → 6.0.0-rc.27
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.
- package/core/src/physics/physics-profile-wasm-module.generated.mjs +1 -1
- package/core/src/physics/physics-wasm-module.generated.mjs +1 -1
- package/core/src/physics2d/physics2d-wasm-module.generated.mjs +1 -1
- package/dist/movement3d.d.ts +2 -0
- package/dist/movement3d.js +74 -5
- package/dist/physics/3d.d.ts +1 -1
- package/dist/physics/3d.js +1015 -120
- package/package.json +1 -1
|
@@ -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.
|
|
26
|
+
"packageVersion": "6.0.0-rc.27",
|
|
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.
|
|
26
|
+
"packageVersion": "6.0.0-rc.27",
|
|
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.
|
|
53
|
+
"packageVersion": "6.0.0-rc.27",
|
|
54
54
|
"compilerFlags": [
|
|
55
55
|
"-std=c++20",
|
|
56
56
|
"-O3",
|
package/dist/movement3d.d.ts
CHANGED
|
@@ -282,6 +282,7 @@ export interface DeterministicKccStepOptions3D {
|
|
|
282
282
|
readonly width: number;
|
|
283
283
|
readonly height: number;
|
|
284
284
|
};
|
|
285
|
+
readonly hostBodyId?: PhysicsBodyId3D | bigint | unknown;
|
|
285
286
|
};
|
|
286
287
|
readonly portalB: {
|
|
287
288
|
readonly position: {
|
|
@@ -299,6 +300,7 @@ export interface DeterministicKccStepOptions3D {
|
|
|
299
300
|
readonly width: number;
|
|
300
301
|
readonly height: number;
|
|
301
302
|
};
|
|
303
|
+
readonly hostBodyId?: PhysicsBodyId3D | bigint | unknown;
|
|
302
304
|
};
|
|
303
305
|
readonly open?: boolean;
|
|
304
306
|
}[];
|
package/dist/movement3d.js
CHANGED
|
@@ -399,6 +399,7 @@ function stepDeterministicKccRevision2_3D(body, input, world, options, gravityPe
|
|
|
399
399
|
swept: false,
|
|
400
400
|
sample: 0,
|
|
401
401
|
collisionFilters,
|
|
402
|
+
portals: options.portals,
|
|
402
403
|
};
|
|
403
404
|
if (options.physics !== undefined) {
|
|
404
405
|
const recovered = depenetrateKccCapsule(options.physics, x, y, z, geometry, context, stats, events);
|
|
@@ -422,7 +423,7 @@ function stepDeterministicKccRevision2_3D(body, input, world, options, gravityPe
|
|
|
422
423
|
stats.rejectedHits += forwardOverlap.collisionFilterRejectedHits;
|
|
423
424
|
let obstructed = forwardOverlap.length > 0;
|
|
424
425
|
if (!obstructed) {
|
|
425
|
-
const sweep = sweepPhysicsKcc3D(options.physics, recoveredPose, { x: targetX, y, z: targetZ, vx, vz }, ignoredBodyIds, options.frame, collisionFilters);
|
|
426
|
+
const sweep = sweepPhysicsKcc3D(options.physics, recoveredPose, { x: targetX, y, z: targetZ, vx, vz }, ignoredBodyIds, options.frame, collisionFilters, options.portals);
|
|
426
427
|
stats.queries += sweep.queryCount;
|
|
427
428
|
stats.filterCalls += sweep.collisionFilterCalls;
|
|
428
429
|
stats.rejectedHits += sweep.collisionFilterRejectedHits;
|
|
@@ -465,7 +466,7 @@ function stepDeterministicKccRevision2_3D(body, input, world, options, gravityPe
|
|
|
465
466
|
}
|
|
466
467
|
}
|
|
467
468
|
if (obstructed && !stepped && !headBlocked) {
|
|
468
|
-
const resolved = resolvePhysicsSlide3D(options.physics, recoveredPose, { x: targetX, y, z: targetZ, vx, vz }, ignoredBodyIds, options.frame, collisionFilters);
|
|
469
|
+
const resolved = resolvePhysicsSlide3D(options.physics, recoveredPose, { x: targetX, y, z: targetZ, vx, vz }, ignoredBodyIds, options.frame, collisionFilters, options.portals);
|
|
469
470
|
stats.queries += resolved.queryCount;
|
|
470
471
|
stats.filterCalls += resolved.collisionFilterCalls;
|
|
471
472
|
stats.rejectedHits += resolved.collisionFilterRejectedHits;
|
|
@@ -2013,7 +2014,7 @@ function estimateKccCollisionNormal(previous, attemptedX, attemptedY, attemptedZ
|
|
|
2013
2014
|
}
|
|
2014
2015
|
return { x: 0, y: 0, z: -1 };
|
|
2015
2016
|
}
|
|
2016
|
-
function resolvePhysicsSlide3D(physics, previous, candidate, ignoredBodyIds, frame, collisionFilters) {
|
|
2017
|
+
function resolvePhysicsSlide3D(physics, previous, candidate, ignoredBodyIds, frame, collisionFilters, portals) {
|
|
2017
2018
|
const filterStateBefore = snapshotCollisionFilters(collisionFilters);
|
|
2018
2019
|
let collisionFilterCalls = 0;
|
|
2019
2020
|
let collisionFilterRejectedHits = 0;
|
|
@@ -2024,11 +2025,12 @@ function resolvePhysicsSlide3D(physics, previous, candidate, ignoredBodyIds, fra
|
|
|
2024
2025
|
swept: false,
|
|
2025
2026
|
sample: 0,
|
|
2026
2027
|
collisionFilters,
|
|
2028
|
+
portals,
|
|
2027
2029
|
});
|
|
2028
2030
|
collisionFilterCalls += fullOverlaps.collisionFilterCalls;
|
|
2029
2031
|
collisionFilterRejectedHits += fullOverlaps.collisionFilterRejectedHits;
|
|
2030
2032
|
if (fullOverlaps.length === 0) {
|
|
2031
|
-
const sweep = sweepPhysicsKcc3D(physics, previous, candidate, ignoredBodyIds, frame, collisionFilters);
|
|
2033
|
+
const sweep = sweepPhysicsKcc3D(physics, previous, candidate, ignoredBodyIds, frame, collisionFilters, portals);
|
|
2032
2034
|
assertKccCollisionFiltersUnchanged(collisionFilters, filterStateBefore);
|
|
2033
2035
|
if (sweep.corrected) {
|
|
2034
2036
|
return {
|
|
@@ -2057,6 +2059,7 @@ function resolvePhysicsSlide3D(physics, previous, candidate, ignoredBodyIds, fra
|
|
|
2057
2059
|
swept: false,
|
|
2058
2060
|
sample: 0,
|
|
2059
2061
|
collisionFilters,
|
|
2062
|
+
portals,
|
|
2060
2063
|
});
|
|
2061
2064
|
const zOverlaps = physicsOverlapsKcc(physics, zOnly.x, candidate.y, zOnly.z, {
|
|
2062
2065
|
ignoredBodyIds,
|
|
@@ -2065,6 +2068,7 @@ function resolvePhysicsSlide3D(physics, previous, candidate, ignoredBodyIds, fra
|
|
|
2065
2068
|
swept: false,
|
|
2066
2069
|
sample: 0,
|
|
2067
2070
|
collisionFilters,
|
|
2071
|
+
portals,
|
|
2068
2072
|
});
|
|
2069
2073
|
collisionFilterCalls += xOverlaps.collisionFilterCalls + zOverlaps.collisionFilterCalls;
|
|
2070
2074
|
collisionFilterRejectedHits += xOverlaps.collisionFilterRejectedHits + zOverlaps.collisionFilterRejectedHits;
|
|
@@ -2102,7 +2106,7 @@ function resolvePhysicsSlide3D(physics, previous, candidate, ignoredBodyIds, fra
|
|
|
2102
2106
|
collisionFilterRejectedHits,
|
|
2103
2107
|
};
|
|
2104
2108
|
}
|
|
2105
|
-
function sweepPhysicsKcc3D(physics, previous, candidate, ignoredBodyIds, frame, collisionFilters) {
|
|
2109
|
+
function sweepPhysicsKcc3D(physics, previous, candidate, ignoredBodyIds, frame, collisionFilters, portals) {
|
|
2106
2110
|
const deltaX = candidate.x - previous.x;
|
|
2107
2111
|
const deltaZ = candidate.z - previous.z;
|
|
2108
2112
|
const rawSamples = Math.max(1, Math.ceil(Math.max(Math.abs(deltaX), Math.abs(deltaZ)) * 2));
|
|
@@ -2124,6 +2128,7 @@ function sweepPhysicsKcc3D(physics, previous, candidate, ignoredBodyIds, frame,
|
|
|
2124
2128
|
swept: true,
|
|
2125
2129
|
sample,
|
|
2126
2130
|
collisionFilters,
|
|
2131
|
+
portals,
|
|
2127
2132
|
});
|
|
2128
2133
|
queryCount += 1;
|
|
2129
2134
|
collisionFilterCalls += overlaps.collisionFilterCalls;
|
|
@@ -2136,6 +2141,7 @@ function sweepPhysicsKcc3D(physics, previous, candidate, ignoredBodyIds, frame,
|
|
|
2136
2141
|
swept: true,
|
|
2137
2142
|
sample,
|
|
2138
2143
|
collisionFilters,
|
|
2144
|
+
portals,
|
|
2139
2145
|
});
|
|
2140
2146
|
const zOnlyOverlaps = physicsOverlapsKcc(physics, lastSafeX, candidate.y, sampleZ, {
|
|
2141
2147
|
ignoredBodyIds,
|
|
@@ -2144,6 +2150,7 @@ function sweepPhysicsKcc3D(physics, previous, candidate, ignoredBodyIds, frame,
|
|
|
2144
2150
|
swept: true,
|
|
2145
2151
|
sample,
|
|
2146
2152
|
collisionFilters,
|
|
2153
|
+
portals,
|
|
2147
2154
|
});
|
|
2148
2155
|
queryCount += 2;
|
|
2149
2156
|
collisionFilterCalls += xOnlyOverlaps.collisionFilterCalls + zOnlyOverlaps.collisionFilterCalls;
|
|
@@ -2199,6 +2206,21 @@ function sweepPhysicsKcc3D(physics, previous, candidate, ignoredBodyIds, frame,
|
|
|
2199
2206
|
assertKccCollisionFiltersUnchanged(collisionFilters, filterStateBefore);
|
|
2200
2207
|
return { ...candidate, corrected: false, slid: false, swept: false, correctionCount: 0, queryCount, collisionFilterCalls, collisionFilterRejectedHits };
|
|
2201
2208
|
}
|
|
2209
|
+
function kccCapsuleFitsAperture(x, y, z, geometry, portalEnd) {
|
|
2210
|
+
const rotNorm = quatNormalizePure(portalEnd.rotation);
|
|
2211
|
+
const localCenter = invRotateVec3Pure(rotNorm, subVec3Pure({ x, y, z }, portalEnd.position));
|
|
2212
|
+
const halfW = portalEnd.opening.width * 0.5;
|
|
2213
|
+
const halfH = portalEnd.opening.height * 0.5;
|
|
2214
|
+
const halfSeg = geometry.halfHeight;
|
|
2215
|
+
const localUp = invRotateVec3Pure(rotNorm, { x: 0, y: 1, z: 0 });
|
|
2216
|
+
const extX = Math.abs(localUp.x) * halfSeg + geometry.radius;
|
|
2217
|
+
const extY = Math.abs(localUp.y) * halfSeg + geometry.radius;
|
|
2218
|
+
const extZ = Math.abs(localUp.z) * halfSeg + geometry.radius;
|
|
2219
|
+
const fitsOpeningX = Math.abs(localCenter.x) + extX <= halfW;
|
|
2220
|
+
const inOpeningY = Math.abs(localCenter.y) <= halfH + halfSeg;
|
|
2221
|
+
const inCorridor = Math.abs(localCenter.z) <= Math.max(1.0, extZ + 0.5);
|
|
2222
|
+
return fitsOpeningX && inOpeningY && inCorridor;
|
|
2223
|
+
}
|
|
2202
2224
|
function physicsOverlapsKcc(physics, x, y, z, context) {
|
|
2203
2225
|
const filterStateBefore = snapshotCollisionFilters(context.collisionFilters);
|
|
2204
2226
|
const geometry = normalizeKccGeometry3D(context.previous);
|
|
@@ -2218,6 +2240,23 @@ function physicsOverlapsKcc(physics, x, y, z, context) {
|
|
|
2218
2240
|
if (context.ignoredBodyIds.has(bodyId)) {
|
|
2219
2241
|
return false;
|
|
2220
2242
|
}
|
|
2243
|
+
if (context.portals && context.portals.length > 0) {
|
|
2244
|
+
for (const pair of context.portals) {
|
|
2245
|
+
if (pair.open === false)
|
|
2246
|
+
continue;
|
|
2247
|
+
for (const end of [pair.portalA, pair.portalB]) {
|
|
2248
|
+
if (end.hostBodyId !== undefined) {
|
|
2249
|
+
const hostId = typeof end.hostBodyId === "object" && end.hostBodyId !== null && "id" in end.hostBodyId
|
|
2250
|
+
? end.hostBodyId.id : end.hostBodyId;
|
|
2251
|
+
if (hostId === bodyId || BigInt(hostId) === BigInt(bodyId)) {
|
|
2252
|
+
if (kccCapsuleFitsAperture(x, y, z, geometry, end)) {
|
|
2253
|
+
return false;
|
|
2254
|
+
}
|
|
2255
|
+
}
|
|
2256
|
+
}
|
|
2257
|
+
}
|
|
2258
|
+
}
|
|
2259
|
+
}
|
|
2221
2260
|
const body = readKccPhysicsBody(physics, bodyId);
|
|
2222
2261
|
const hit = createKccCollisionCandidate(bodyId, body, context, x, y, z);
|
|
2223
2262
|
for (const filter of filters) {
|
|
@@ -2242,6 +2281,36 @@ function filterKccHits(physics, hits, ignoredBodyIds, collisionFilters, context,
|
|
|
2242
2281
|
if (ignoredBodyIds.has(hit.bodyId)) {
|
|
2243
2282
|
continue;
|
|
2244
2283
|
}
|
|
2284
|
+
if (context.portals && context.portals.length > 0) {
|
|
2285
|
+
let isHostApertureHit = false;
|
|
2286
|
+
const geometry = normalizeKccGeometry3D(context.previous);
|
|
2287
|
+
for (const pair of context.portals) {
|
|
2288
|
+
if (pair.open === false)
|
|
2289
|
+
continue;
|
|
2290
|
+
for (const end of [pair.portalA, pair.portalB]) {
|
|
2291
|
+
if (end.hostBodyId !== undefined) {
|
|
2292
|
+
const hostId = typeof end.hostBodyId === "object" && end.hostBodyId !== null && "id" in end.hostBodyId
|
|
2293
|
+
? end.hostBodyId.id : end.hostBodyId;
|
|
2294
|
+
if (hostId === hit.bodyId || BigInt(hostId) === BigInt(hit.bodyId)) {
|
|
2295
|
+
const rotNorm = quatNormalizePure(end.rotation);
|
|
2296
|
+
const localHit = invRotateVec3Pure(rotNorm, subVec3Pure(hit.point, end.position));
|
|
2297
|
+
const halfW = end.opening.width * 0.5;
|
|
2298
|
+
const halfH = end.opening.height * 0.5;
|
|
2299
|
+
if (Math.abs(localHit.x) <= halfW &&
|
|
2300
|
+
Math.abs(localHit.y) <= halfH &&
|
|
2301
|
+
kccCapsuleFitsAperture(x, y, z, geometry, end)) {
|
|
2302
|
+
isHostApertureHit = true;
|
|
2303
|
+
break;
|
|
2304
|
+
}
|
|
2305
|
+
}
|
|
2306
|
+
}
|
|
2307
|
+
}
|
|
2308
|
+
if (isHostApertureHit)
|
|
2309
|
+
break;
|
|
2310
|
+
}
|
|
2311
|
+
if (isHostApertureHit)
|
|
2312
|
+
continue;
|
|
2313
|
+
}
|
|
2245
2314
|
const body = readKccPhysicsBody(physics, hit.bodyId);
|
|
2246
2315
|
const candidate = createKccCollisionCandidate(hit.bodyId, body, context, x, y, z);
|
|
2247
2316
|
let keep = true;
|
package/dist/physics/3d.d.ts
CHANGED
|
@@ -808,7 +808,7 @@ export interface PortalEndDefinition {
|
|
|
808
808
|
readonly position: PhysicsVector3D<number>;
|
|
809
809
|
readonly rotation: PhysicsQuaternion3D;
|
|
810
810
|
readonly opening: PortalOpeningDefinition;
|
|
811
|
-
readonly hostBodyId?: PhysicsBodyId3D | bigint;
|
|
811
|
+
readonly hostBodyId?: PhysicsBodyId3D | bigint | PhysicsBodyReference3D;
|
|
812
812
|
}
|
|
813
813
|
export interface PortalPairDefinition {
|
|
814
814
|
readonly portalA: PortalEndDefinition;
|