@daneren2005/shared-memory-physics 1.6.2 → 1.6.3
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/dist/index.js
CHANGED
|
@@ -1434,7 +1434,7 @@ function wn(e, t) {
|
|
|
1434
1434
|
}
|
|
1435
1435
|
//#endregion
|
|
1436
1436
|
//#region src/systems/interpolation-update.ts
|
|
1437
|
-
var Tn = (e, t, n) => {
|
|
1437
|
+
var Tn = 1.5, En = .5, Dn = (e, t, n) => {
|
|
1438
1438
|
let r = n.interpolation, a = n.transform, o = i(r, 7), s = r[6], c = r[8], l = a[0], u = a[1], d = i(r, 7);
|
|
1439
1439
|
if (o !== d) return;
|
|
1440
1440
|
if (s <= 0) {
|
|
@@ -1450,16 +1450,18 @@ var Tn = (e, t, n) => {
|
|
|
1450
1450
|
r[10] = 0, r[0] = l, r[1] = u;
|
|
1451
1451
|
return;
|
|
1452
1452
|
}
|
|
1453
|
-
let m = Math.min(Math.max(e.elapsedTime, 0), p), h =
|
|
1454
|
-
|
|
1455
|
-
|
|
1453
|
+
let m = Math.min(Math.max(e.elapsedTime, 0), p), h = s * Tn, g = p - m;
|
|
1454
|
+
g > h && (m += Math.min(g - h, m * En));
|
|
1455
|
+
let _ = m / p, v = r[0], y = r[1];
|
|
1456
|
+
r[0] = v + (l - v) * _, r[1] = y + (u - y) * _, r[10] = p - m;
|
|
1457
|
+
}, On = class extends r {
|
|
1456
1458
|
constructor(e, t = {}) {
|
|
1457
1459
|
super(e, {
|
|
1458
1460
|
name: t.name ?? "InterpolationSystem",
|
|
1459
1461
|
deltaBetweenRuns: 0,
|
|
1460
1462
|
firstRun: t.firstRun,
|
|
1461
1463
|
required: ["transform", "interpolation"],
|
|
1462
|
-
updateFunction:
|
|
1464
|
+
updateFunction: Dn,
|
|
1463
1465
|
forceMainThread: t.forceMainThread ?? !t.getWorker,
|
|
1464
1466
|
getWorker: t.getWorker ?? (() => {
|
|
1465
1467
|
throw Error("InterpolationSystem cannot start a worker: no getWorker was supplied");
|
|
@@ -1468,6 +1470,6 @@ var Tn = (e, t, n) => {
|
|
|
1468
1470
|
}
|
|
1469
1471
|
};
|
|
1470
1472
|
//#endregion
|
|
1471
|
-
export { pe as BODY_CATEGORY_INDEX, ve as BODY_CCD_FLAG, ye as BODY_DYING_FLAG, fe as BODY_FLAGS_INDEX, me as BODY_MASK_INDEX, _e as BODY_SENSOR_FLAG, ge as BODY_SHAPE_MASK, he as BODY_SIZE, De as BOUNCINESS_INDEX, Oe as BOUNCINESS_SIZE, Vt as COLLIDABLE_QUERY, Wt as CollisionBroadphase, le as DEFAULT_COLLIDE_CATEGORY, ue as DEFAULT_COLLIDE_MASK, xn as DEFAULT_PHYSICS_STEP_MS, N as DYNAMICS_ACCELERATION_X_INDEX, ee as DYNAMICS_ACCELERATION_Y_INDEX, P as DYNAMICS_INVERSE_MASS_INDEX, F as DYNAMICS_SIZE, Le as INTERPOLATION_DURATION_INDEX, Ne as INTERPOLATION_PREV_X_INDEX, Pe as INTERPOLATION_PREV_Y_INDEX, Fe as INTERPOLATION_PROGRESS_INDEX, Ve as INTERPOLATION_REMAINING_DURATION_INDEX, He as INTERPOLATION_SIZE, Be as INTERPOLATION_SYNCED_DURATION_INDEX, Ie as INTERPOLATION_SYNCED_TICK_INDEX, Re as INTERPOLATION_TICK_INDEX, ze as INTERPOLATION_TOTAL_DURATION_INDEX, je as INTERPOLATION_X_INDEX, Me as INTERPOLATION_Y_INDEX,
|
|
1473
|
+
export { pe as BODY_CATEGORY_INDEX, ve as BODY_CCD_FLAG, ye as BODY_DYING_FLAG, fe as BODY_FLAGS_INDEX, me as BODY_MASK_INDEX, _e as BODY_SENSOR_FLAG, ge as BODY_SHAPE_MASK, he as BODY_SIZE, De as BOUNCINESS_INDEX, Oe as BOUNCINESS_SIZE, Vt as COLLIDABLE_QUERY, Wt as CollisionBroadphase, le as DEFAULT_COLLIDE_CATEGORY, ue as DEFAULT_COLLIDE_MASK, xn as DEFAULT_PHYSICS_STEP_MS, N as DYNAMICS_ACCELERATION_X_INDEX, ee as DYNAMICS_ACCELERATION_Y_INDEX, P as DYNAMICS_INVERSE_MASS_INDEX, F as DYNAMICS_SIZE, Le as INTERPOLATION_DURATION_INDEX, Ne as INTERPOLATION_PREV_X_INDEX, Pe as INTERPOLATION_PREV_Y_INDEX, Fe as INTERPOLATION_PROGRESS_INDEX, Ve as INTERPOLATION_REMAINING_DURATION_INDEX, He as INTERPOLATION_SIZE, Be as INTERPOLATION_SYNCED_DURATION_INDEX, Ie as INTERPOLATION_SYNCED_TICK_INDEX, Re as INTERPOLATION_TICK_INDEX, ze as INTERPOLATION_TOTAL_DURATION_INDEX, je as INTERPOLATION_X_INDEX, Me as INTERPOLATION_Y_INDEX, On as InterpolationSystem, l as MAX_POLYGON_VERTICES, f as POLYGON_SIZE, u as POLYGON_VERTEX_COUNT_INDEX, d as POLYGON_VERTICES_INDEX, ln as POSITION_UPDATED_EVENT, mt as PhysicalWorld, Cn as PhysicsSystem, oe as SHAPE_CAPSULE, ae as SHAPE_CIRCLE, se as SHAPE_POLYGON, ie as SHAPE_RECTANGLE, Zt as SpatialIndex, S as TRANSFORM_ANGLE_INDEX, x as TRANSFORM_HEIGHT_INDEX, C as TRANSFORM_SIZE, b as TRANSFORM_WIDTH_INDEX, v as TRANSFORM_X_INDEX, y as TRANSFORM_Y_INDEX, O as VELOCITY_DAMPING_INDEX, k as VELOCITY_SIZE, E as VELOCITY_X_INDEX, D as VELOCITY_Y_INDEX, ft as addPhysicalWorldData, we as bodyDefinition, L as bodyShape, Ae as bouncinessDefinition, rt as boundsHalfHeight, nt as boundsHalfWidth, de as canCollide, V as capsuleHalfLength, Ye as contactNormal, dn as createPhysicsUpdate, te as dynamicsDefinition, pt as getSpatialMap, Mt as integrateDynamics, We as interpolationDefinition, Dn as interpolationUpdate, be as isContinuous, xe as isDying, R as isSensor, Se as markDying, it as orientedBoxesOverlap, qe as physicsRegistry, _n as physicsUpdate, J as pointSegmentDistanceSquared, vt as polygonContactNormal, m as polygonDefinition, _t as polygonShapesOverlap, h as preparePolygon, ot as segmentBoxDistanceSquared, at as segmentSegmentDistanceSquared, G as shapeHalfHeight, W as shapeHalfWidth, U as shapeIsEmpty, H as shapeRadius, Je as shapesOverlap, Ge as snapEntity, Ke as startSpawnInterpolation, T as transformDefinition, cn as updateSpatialMap, j as velocityDefinition };
|
|
1472
1474
|
|
|
1473
1475
|
//# sourceMappingURL=index.js.map
|