@woosh/meep-engine 2.146.0 → 2.148.0
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/package.json +1 -1
- package/src/core/math/spline/spline3_hermite_intersection_spline3_hermite.d.ts +4 -4
- package/src/core/math/spline/spline3_hermite_intersection_spline3_hermite.d.ts.map +1 -1
- package/src/core/math/spline/spline3_hermite_intersection_spline3_hermite.js +48 -52
- package/src/core/math/spline/spline3_hermite_intersection_spline3_hermite_2d.d.ts +23 -21
- package/src/core/math/spline/spline3_hermite_intersection_spline3_hermite_2d.d.ts.map +1 -1
- package/src/core/math/spline/spline3_hermite_intersection_spline3_hermite_2d.js +41 -406
- package/src/core/math/spline/spline3_hermite_intersection_spline3_hermite_nd.d.ts +5 -4
- package/src/core/math/spline/spline3_hermite_intersection_spline3_hermite_nd.d.ts.map +1 -1
- package/src/core/math/spline/spline3_hermite_intersection_spline3_hermite_nd.js +400 -395
- package/src/engine/control/first-person/FirstPersonPlayerController.d.ts +0 -11
- package/src/engine/control/first-person/FirstPersonPlayerController.d.ts.map +1 -1
- package/src/engine/control/first-person/FirstPersonPlayerControllerConfig.d.ts +8 -6
- package/src/engine/control/first-person/FirstPersonPlayerControllerConfig.d.ts.map +1 -1
- package/src/engine/control/first-person/FirstPersonPlayerControllerConfig.js +552 -551
- package/src/engine/control/first-person/abilities/LedgeGrab.d.ts +8 -3
- package/src/engine/control/first-person/abilities/LedgeGrab.d.ts.map +1 -1
- package/src/engine/control/first-person/abilities/LedgeGrab.js +213 -199
- package/src/engine/control/first-person/abilities/Mantle.d.ts.map +1 -1
- package/src/engine/control/first-person/abilities/Mantle.js +195 -188
- package/src/engine/control/first-person/abilities/WallRun.d.ts.map +1 -1
- package/src/engine/control/first-person/abilities/WallRun.js +183 -175
- package/src/engine/control/first-person/sensors/FirstPersonSensors.d.ts +9 -0
- package/src/engine/control/first-person/sensors/FirstPersonSensors.d.ts.map +1 -1
- package/src/engine/control/first-person/sensors/FirstPersonSensors.js +87 -77
- package/src/engine/control/first-person/sensors/FirstPersonSensorsSystem.d.ts +8 -0
- package/src/engine/control/first-person/sensors/FirstPersonSensorsSystem.d.ts.map +1 -1
- package/src/engine/control/first-person/sensors/FirstPersonSensorsSystem.js +229 -196
- package/src/engine/ecs/EntityManager.d.ts +34 -11
- package/src/engine/ecs/EntityManager.d.ts.map +1 -1
- package/src/engine/ecs/EntityManager.js +71 -42
- package/src/engine/interpolation/BinaryInterpolationAdapter.d.ts.map +1 -0
- package/src/engine/interpolation/Interpoland.d.ts +48 -0
- package/src/engine/interpolation/Interpoland.d.ts.map +1 -0
- package/src/engine/interpolation/Interpoland.js +49 -0
- package/src/engine/interpolation/Interpolated.d.ts +101 -0
- package/src/engine/interpolation/Interpolated.d.ts.map +1 -0
- package/src/engine/interpolation/Interpolated.js +149 -0
- package/src/engine/{network/sim → interpolation}/InterpolationLog.d.ts +1 -1
- package/src/engine/interpolation/InterpolationLog.d.ts.map +1 -0
- package/src/engine/{network/sim → interpolation}/InterpolationLog.js +2 -2
- package/src/engine/interpolation/InterpolationSystem.d.ts +116 -0
- package/src/engine/interpolation/InterpolationSystem.d.ts.map +1 -0
- package/src/engine/interpolation/InterpolationSystem.js +233 -0
- package/src/engine/interpolation/PoseInterpolationAdapter.d.ts +17 -0
- package/src/engine/interpolation/PoseInterpolationAdapter.d.ts.map +1 -0
- package/src/engine/interpolation/PoseInterpolationAdapter.js +61 -0
- package/src/engine/interpolation/TransformPoseSerializationAdapter.d.ts +35 -0
- package/src/engine/interpolation/TransformPoseSerializationAdapter.d.ts.map +1 -0
- package/src/engine/interpolation/TransformPoseSerializationAdapter.js +57 -0
- package/src/engine/interpolation/pose_interpoland.d.ts +18 -0
- package/src/engine/interpolation/pose_interpoland.d.ts.map +1 -0
- package/src/engine/interpolation/pose_interpoland.js +27 -0
- package/src/engine/network/NetworkSession.d.ts +2 -2
- package/src/engine/network/NetworkSession.d.ts.map +1 -1
- package/src/engine/network/NetworkSession.js +2 -2
- package/src/engine/network/adapters/QuaternionInterpolationAdapter.d.ts +1 -1
- package/src/engine/network/adapters/QuaternionInterpolationAdapter.d.ts.map +1 -1
- package/src/engine/network/adapters/QuaternionInterpolationAdapter.js +1 -1
- package/src/engine/network/adapters/TransformInterpolationAdapter.d.ts +1 -1
- package/src/engine/network/adapters/TransformInterpolationAdapter.d.ts.map +1 -1
- package/src/engine/network/adapters/TransformInterpolationAdapter.js +1 -1
- package/src/engine/network/adapters/Vector3InterpolationAdapter.d.ts +1 -1
- package/src/engine/network/adapters/Vector3InterpolationAdapter.d.ts.map +1 -1
- package/src/engine/network/adapters/Vector3InterpolationAdapter.js +1 -1
- package/src/engine/physics/INTEPOLATION_SYSTEM_PLAN.md +287 -0
- package/src/engine/physics/PLAN.md +10 -9
- package/src/engine/physics/body/SolverBodyState.d.ts +142 -0
- package/src/engine/physics/body/SolverBodyState.d.ts.map +1 -0
- package/src/engine/physics/body/SolverBodyState.js +251 -0
- package/src/engine/physics/broadphase/generate_pairs.d.ts +2 -1
- package/src/engine/physics/broadphase/generate_pairs.d.ts.map +1 -1
- package/src/engine/physics/broadphase/generate_pairs.js +5 -3
- package/src/engine/physics/constraint/solve_constraints.d.ts.map +1 -1
- package/src/engine/physics/constraint/solve_constraints.js +691 -673
- package/src/engine/physics/ecs/PhysicsSystem.d.ts +82 -15
- package/src/engine/physics/ecs/PhysicsSystem.d.ts.map +1 -1
- package/src/engine/physics/ecs/PhysicsSystem.js +387 -87
- package/src/engine/physics/inertia/world_inverse_inertia.d.ts +23 -0
- package/src/engine/physics/inertia/world_inverse_inertia.d.ts.map +1 -1
- package/src/engine/physics/inertia/world_inverse_inertia.js +116 -77
- package/src/engine/physics/integration/integrate_position.d.ts +11 -1
- package/src/engine/physics/integration/integrate_position.d.ts.map +1 -1
- package/src/engine/physics/integration/integrate_position.js +97 -79
- package/src/engine/physics/integration/integrate_velocity.d.ts +12 -3
- package/src/engine/physics/integration/integrate_velocity.d.ts.map +1 -1
- package/src/engine/physics/integration/integrate_velocity.js +201 -160
- package/src/engine/physics/narrowphase/box_box_manifold.d.ts.map +1 -1
- package/src/engine/physics/narrowphase/box_box_manifold.js +750 -665
- package/src/engine/physics/narrowphase/box_triangle_contact.d.ts.map +1 -1
- package/src/engine/physics/narrowphase/box_triangle_contact.js +19 -46
- package/src/engine/physics/narrowphase/clip_against_axis_uv.d.ts +16 -0
- package/src/engine/physics/narrowphase/clip_against_axis_uv.d.ts.map +1 -0
- package/src/engine/physics/narrowphase/clip_against_axis_uv.js +49 -0
- package/src/engine/physics/narrowphase/narrowphase_step.d.ts.map +1 -1
- package/src/engine/physics/narrowphase/narrowphase_step.js +52 -4
- package/src/engine/physics/queries/raycast.d.ts.map +1 -1
- package/src/engine/physics/queries/raycast.js +7 -4
- package/src/engine/physics/solver/solve_contacts.d.ts +2 -2
- package/src/engine/physics/solver/solve_contacts.d.ts.map +1 -1
- package/src/engine/physics/solver/solve_contacts.js +1341 -1173
- package/src/engine/network/sim/BinaryInterpolationAdapter.d.ts.map +0 -1
- package/src/engine/network/sim/InterpolationLog.d.ts.map +0 -1
- /package/src/engine/{network/sim → interpolation}/BinaryInterpolationAdapter.d.ts +0 -0
- /package/src/engine/{network/sim → interpolation}/BinaryInterpolationAdapter.js +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"box_triangle_contact.d.ts","sourceRoot":"","sources":["../../../../../src/engine/physics/narrowphase/box_triangle_contact.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"box_triangle_contact.d.ts","sourceRoot":"","sources":["../../../../../src/engine/physics/narrowphase/box_triangle_contact.js"],"names":[],"mappings":"AAyLA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,0CAtBW,MAAM,EAAE,GAAC,YAAY,OACrB,MAAM,OACN,MAAM,OACN,MAAM,OACN,MAAM,OACN,MAAM,OACN,MAAM,OACN,MAAM,OACN,MAAM,OACN,MAAM,OACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,GACJ,OAAO,CAuJnB;AAvSD;;;GAGG;AACH,sCAFU,MAAM,CAEyD"}
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
line3_closest_points_segment_segment
|
|
3
|
+
} from "../../../core/geom/3d/line/line3_closest_points_segment_segment.js";
|
|
2
4
|
import { quat3_to_matrix3 } from "../../../core/geom/3d/quaternion/quat3_to_matrix3.js";
|
|
5
|
+
import { clip_against_axis_uv } from "./clip_against_axis_uv.js";
|
|
3
6
|
|
|
4
7
|
/**
|
|
5
8
|
* Multi-point manifold construction for an oriented box vs. a triangle.
|
|
@@ -97,39 +100,6 @@ function projected_box_half_extent(axes, hx, hy, hz, ux, uy, uz) {
|
|
|
97
100
|
+ (pz < 0 ? -pz : pz) * hz;
|
|
98
101
|
}
|
|
99
102
|
|
|
100
|
-
/**
|
|
101
|
-
* Sutherland-Hodgman clip of `points_in` against the axis-aligned
|
|
102
|
-
* half-plane `coord_idx ≤ bound` (or `coord_idx ≥ bound` when
|
|
103
|
-
* `keep_below` is false). 2D stride 2; result to `points_out`.
|
|
104
|
-
* Returns surviving vertex count.
|
|
105
|
-
*/
|
|
106
|
-
function clip_against_axis_uv(points_in, point_count, points_out, coord_idx, bound, keep_below) {
|
|
107
|
-
let out_count = 0;
|
|
108
|
-
for (let i = 0; i < point_count; i++) {
|
|
109
|
-
const j = (i + 1) % point_count;
|
|
110
|
-
const ax = points_in[i * 2], ay = points_in[i * 2 + 1];
|
|
111
|
-
const bx = points_in[j * 2], by = points_in[j * 2 + 1];
|
|
112
|
-
const av = coord_idx === 0 ? ax : ay;
|
|
113
|
-
const bv = coord_idx === 0 ? bx : by;
|
|
114
|
-
const a_inside = keep_below ? (av <= bound) : (av >= bound);
|
|
115
|
-
const b_inside = keep_below ? (bv <= bound) : (bv >= bound);
|
|
116
|
-
|
|
117
|
-
if (a_inside) {
|
|
118
|
-
points_out[out_count * 2] = ax;
|
|
119
|
-
points_out[out_count * 2 + 1] = ay;
|
|
120
|
-
out_count++;
|
|
121
|
-
}
|
|
122
|
-
if (a_inside !== b_inside) {
|
|
123
|
-
const denom = bv - av;
|
|
124
|
-
const t = denom !== 0 ? (bound - av) / denom : 0;
|
|
125
|
-
points_out[out_count * 2] = ax + (bx - ax) * t;
|
|
126
|
-
points_out[out_count * 2 + 1] = ay + (by - ay) * t;
|
|
127
|
-
out_count++;
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
return out_count;
|
|
131
|
-
}
|
|
132
|
-
|
|
133
103
|
/**
|
|
134
104
|
* Sutherland-Hodgman clip of `points_in` against the general half-plane
|
|
135
105
|
* `(p - (line_ox, line_oy)) · (line_nx, line_ny) ≤ 0`. 2D stride 2;
|
|
@@ -524,18 +494,21 @@ function emit_triangle_face_manifold(
|
|
|
524
494
|
tnx, tny, tnz,
|
|
525
495
|
nx, ny, nz
|
|
526
496
|
) {
|
|
527
|
-
//
|
|
528
|
-
//
|
|
529
|
-
// the
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
//
|
|
534
|
-
//
|
|
535
|
-
//
|
|
536
|
-
//
|
|
537
|
-
//
|
|
538
|
-
//
|
|
497
|
+
// Reference = triangle. Its outward face normal points from the triangle
|
|
498
|
+
// surface toward the box — i.e. the contact normal `n` (triangle → box),
|
|
499
|
+
// which the SAT already sign-canonicalised. The incident box face is then
|
|
500
|
+
// the one whose outward normal is most antiparallel to this (the box face
|
|
501
|
+
// actually facing the triangle), and the per-point depth below measures the
|
|
502
|
+
// penetration of THAT face — not the box's far face.
|
|
503
|
+
//
|
|
504
|
+
// (The earlier `-n` here pointed the reference normal into the terrain, so
|
|
505
|
+
// the incident picker selected the box's FAR face and the plane-to-plane
|
|
506
|
+
// depth ballooned to ~the box's thickness for any tilted box — catapulting
|
|
507
|
+
// rocking boxes off heightmaps. See box_triangle_contact.spec.js
|
|
508
|
+
// "tilted box, shallow corner".)
|
|
509
|
+
const ref_out_x = nx;
|
|
510
|
+
const ref_out_y = ny;
|
|
511
|
+
const ref_out_z = nz;
|
|
539
512
|
|
|
540
513
|
// Pick the incident box face: the one whose outward axis is most
|
|
541
514
|
// antiparallel to ref_out.
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Sutherland-Hodgman clip of `points_in` against the axis-aligned
|
|
3
|
+
* half-plane `coord_idx ≤ bound` (or `coord_idx ≥ bound` when
|
|
4
|
+
* `keep_below` is false). 2D stride 2; result to `points_out`.
|
|
5
|
+
* Returns surviving vertex count.
|
|
6
|
+
*
|
|
7
|
+
* @param {Float64Array} points_in
|
|
8
|
+
* @param {number} point_count
|
|
9
|
+
* @param {Float64Array} points_out
|
|
10
|
+
* @param {number} coord_idx 0 = u, 1 = v
|
|
11
|
+
* @param {number} bound
|
|
12
|
+
* @param {boolean} keep_below true to keep points with coord ≤ bound
|
|
13
|
+
* @returns {number} surviving vertex count
|
|
14
|
+
*/
|
|
15
|
+
export function clip_against_axis_uv(points_in: Float64Array, point_count: number, points_out: Float64Array, coord_idx: number, bound: number, keep_below: boolean): number;
|
|
16
|
+
//# sourceMappingURL=clip_against_axis_uv.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"clip_against_axis_uv.d.ts","sourceRoot":"","sources":["../../../../../src/engine/physics/narrowphase/clip_against_axis_uv.js"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,gDARW,YAAY,eACZ,MAAM,cACN,YAAY,aACZ,MAAM,SACN,MAAM,cACN,OAAO,GACL,MAAM,CAoClB"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Sutherland-Hodgman clip of `points_in` against the axis-aligned
|
|
3
|
+
* half-plane `coord_idx ≤ bound` (or `coord_idx ≥ bound` when
|
|
4
|
+
* `keep_below` is false). 2D stride 2; result to `points_out`.
|
|
5
|
+
* Returns surviving vertex count.
|
|
6
|
+
*
|
|
7
|
+
* @param {Float64Array} points_in
|
|
8
|
+
* @param {number} point_count
|
|
9
|
+
* @param {Float64Array} points_out
|
|
10
|
+
* @param {number} coord_idx 0 = u, 1 = v
|
|
11
|
+
* @param {number} bound
|
|
12
|
+
* @param {boolean} keep_below true to keep points with coord ≤ bound
|
|
13
|
+
* @returns {number} surviving vertex count
|
|
14
|
+
*/
|
|
15
|
+
export function clip_against_axis_uv(points_in, point_count, points_out, coord_idx, bound, keep_below) {
|
|
16
|
+
let out_count = 0;
|
|
17
|
+
|
|
18
|
+
for (let i = 0; i < point_count; i++) {
|
|
19
|
+
const j = (i + 1) % point_count;
|
|
20
|
+
|
|
21
|
+
const ax = points_in[i * 2], ay = points_in[i * 2 + 1];
|
|
22
|
+
const bx = points_in[j * 2], by = points_in[j * 2 + 1];
|
|
23
|
+
|
|
24
|
+
const av = coord_idx === 0 ? ax : ay;
|
|
25
|
+
const bv = coord_idx === 0 ? bx : by;
|
|
26
|
+
|
|
27
|
+
const a_inside = keep_below ? (av <= bound) : (av >= bound);
|
|
28
|
+
const b_inside = keep_below ? (bv <= bound) : (bv >= bound);
|
|
29
|
+
|
|
30
|
+
if (a_inside) {
|
|
31
|
+
points_out[out_count * 2] = ax;
|
|
32
|
+
points_out[out_count * 2 + 1] = ay;
|
|
33
|
+
out_count++;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
if (a_inside !== b_inside) {
|
|
37
|
+
|
|
38
|
+
const denom = bv - av;
|
|
39
|
+
const t = denom !== 0 ? (bound - av) / denom : 0;
|
|
40
|
+
|
|
41
|
+
points_out[out_count * 2] = ax + (bx - ax) * t;
|
|
42
|
+
points_out[out_count * 2 + 1] = ay + (by - ay) * t;
|
|
43
|
+
|
|
44
|
+
out_count++;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
return out_count;
|
|
49
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"narrowphase_step.d.ts","sourceRoot":"","sources":["../../../../../src/engine/physics/narrowphase/narrowphase_step.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"narrowphase_step.d.ts","sourceRoot":"","sources":["../../../../../src/engine/physics/narrowphase/narrowphase_step.js"],"names":[],"mappings":"AA8zCA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,qDAVW,YAAY,GAAC,MAAM,EAAE,iCAGrB;IAAC,CAAC,EAAC,MAAM,CAAC;IAAA,CAAC,EAAC,MAAM,CAAC;IAAA,CAAC,EAAC,MAAM,CAAA;CAAC,QAC5B;IAAC,CAAC,EAAC,MAAM,CAAC;IAAA,CAAC,EAAC,MAAM,CAAC;IAAA,CAAC,EAAC,MAAM,CAAC;IAAA,CAAC,EAAC,MAAM,CAAA;CAAC,iCAErC;IAAC,CAAC,EAAC,MAAM,CAAC;IAAA,CAAC,EAAC,MAAM,CAAC;IAAA,CAAC,EAAC,MAAM,CAAA;CAAC,QAC5B;IAAC,CAAC,EAAC,MAAM,CAAC;IAAA,CAAC,EAAC,MAAM,CAAC;IAAA,CAAC,EAAC,MAAM,CAAC;IAAA,CAAC,EAAC,MAAM,CAAA;CAAC,GACnC,MAAM,CAyClB;AAED;;;;;;;;;;;GAWG;AACH,uFALW,MAAM,MAAM;IAAC,QAAQ,WAAW;IAAC,SAAS,YAAW;CAAC,CAAC,CAAC,QA4KlE;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,uEAJW,MAAM,UACN,MAAM;IAAC,QAAQ,WAAW;IAAC,SAAS,YAAW;CAAC,CAAC,UACjD,MAAM;IAAC,QAAQ,WAAW;IAAC,SAAS,YAAW;CAAC,CAAC,QAkH3D"}
|
|
@@ -403,9 +403,12 @@ function dispatch_pair(count, colA, trA, colB, trB, gjk_axis_buf = null, gjk_axi
|
|
|
403
403
|
// `deepest_pair_penetration` query passes bare `{shape}` adapters with no
|
|
404
404
|
// material fields — it never writes to a manifold, so 0 is fine there.
|
|
405
405
|
const fa = colA.friction, fb = colB.friction;
|
|
406
|
+
|
|
406
407
|
if (fa !== undefined && fb !== undefined) {
|
|
408
|
+
|
|
407
409
|
g_pair_friction = combine_friction(fa, fb);
|
|
408
410
|
g_pair_restitution = combine_restitution(colA.restitution, colB.restitution);
|
|
411
|
+
|
|
409
412
|
} else {
|
|
410
413
|
g_pair_friction = 0;
|
|
411
414
|
g_pair_restitution = 0;
|
|
@@ -1429,22 +1432,29 @@ export function narrowphase_step(pair_list, manifolds, lists) {
|
|
|
1429
1432
|
for (let i = 0; i < count; i++) {
|
|
1430
1433
|
const idA = pair_list.get_a(i);
|
|
1431
1434
|
const idB = pair_list.get_b(i);
|
|
1435
|
+
|
|
1432
1436
|
const idxA = body_id_index(idA);
|
|
1433
1437
|
const idxB = body_id_index(idB);
|
|
1434
1438
|
|
|
1435
1439
|
const list_a = lists[idxA];
|
|
1436
1440
|
const list_b = lists[idxB];
|
|
1441
|
+
|
|
1437
1442
|
const slot = manifolds.find(idA, idB);
|
|
1438
1443
|
|
|
1439
1444
|
if (list_a === undefined || list_b === undefined
|
|
1440
|
-
|| list_a.length === 0 || list_b.length === 0
|
|
1445
|
+
|| list_a.length === 0 || list_b.length === 0
|
|
1446
|
+
) {
|
|
1447
|
+
|
|
1441
1448
|
manifolds.clear_contacts(slot);
|
|
1442
1449
|
continue;
|
|
1450
|
+
|
|
1443
1451
|
}
|
|
1444
1452
|
|
|
1445
1453
|
let cand_count = 0;
|
|
1454
|
+
|
|
1446
1455
|
const la_len = list_a.length;
|
|
1447
1456
|
const lb_len = list_b.length;
|
|
1457
|
+
|
|
1448
1458
|
// Per-manifold cached GJK separating-axis seed. Threaded into
|
|
1449
1459
|
// dispatch_pair for the GJK fallback paths. For single-collider
|
|
1450
1460
|
// bodies (the common case) there's no contention across the
|
|
@@ -1453,12 +1463,23 @@ export function narrowphase_step(pair_list, manifolds, lists) {
|
|
|
1453
1463
|
// seed (better than a cold (1, 0, 0) restart every frame).
|
|
1454
1464
|
const gjk_axis_buf = manifolds.slot_axis_buffer;
|
|
1455
1465
|
const gjk_axis_off = manifolds.slot_axis_offset(slot);
|
|
1466
|
+
|
|
1456
1467
|
for (let a = 0; a < la_len; a++) {
|
|
1457
1468
|
const ea = list_a[a];
|
|
1469
|
+
|
|
1458
1470
|
for (let b = 0; b < lb_len; b++) {
|
|
1459
1471
|
const eb = list_b[b];
|
|
1460
|
-
|
|
1461
|
-
|
|
1472
|
+
|
|
1473
|
+
cand_count = dispatch_pair(
|
|
1474
|
+
cand_count,
|
|
1475
|
+
ea.collider,
|
|
1476
|
+
ea.transform,
|
|
1477
|
+
eb.collider,
|
|
1478
|
+
eb.transform,
|
|
1479
|
+
gjk_axis_buf,
|
|
1480
|
+
gjk_axis_off
|
|
1481
|
+
);
|
|
1482
|
+
|
|
1462
1483
|
}
|
|
1463
1484
|
}
|
|
1464
1485
|
|
|
@@ -1667,7 +1688,34 @@ export function redetect_pair_geometry(manifolds, slot, list_a, list_b) {
|
|
|
1667
1688
|
}
|
|
1668
1689
|
}
|
|
1669
1690
|
|
|
1670
|
-
|
|
1691
|
+
// Position fallback (mirrors narrowphase_step's match-and-merge). A
|
|
1692
|
+
// single triangle's clipped contact count is NOT stable across sub-mm
|
|
1693
|
+
// pose changes — a box straddling a cell seam can have one triangle
|
|
1694
|
+
// yield 4 points one substep and 3 the next — so an existing contact can
|
|
1695
|
+
// outnumber this substep's same-fid candidates. Freezing its stale
|
|
1696
|
+
// witness then duplicates a sibling contact's point, leaving a
|
|
1697
|
+
// degenerate (sub-dimensional) manifold. Instead, claim the nearest
|
|
1698
|
+
// unclaimed candidate of ANY fid: every contact keeps a DISTINCT live
|
|
1699
|
+
// witness. The fid label is left intact and re-resolved by the next
|
|
1700
|
+
// once-per-step narrowphase. (At a fixed pose the same-fid match always
|
|
1701
|
+
// succeeds, so this never fires for the depth-equality guards or the
|
|
1702
|
+
// one-contact-per-triangle sphere/mesh paths.)
|
|
1703
|
+
if (best_k === -1) {
|
|
1704
|
+
for (let k = 0; k < cc; k++) {
|
|
1705
|
+
if (redetect_claimed[k] === 1) continue;
|
|
1706
|
+
const co = k * CANDIDATE_STRIDE;
|
|
1707
|
+
const dx = candidates[co] - pax;
|
|
1708
|
+
const dy = candidates[co + 1] - pay;
|
|
1709
|
+
const dz = candidates[co + 2] - paz;
|
|
1710
|
+
const d2 = dx * dx + dy * dy + dz * dz;
|
|
1711
|
+
if (d2 < best_d2) {
|
|
1712
|
+
best_d2 = d2;
|
|
1713
|
+
best_k = k;
|
|
1714
|
+
}
|
|
1715
|
+
}
|
|
1716
|
+
}
|
|
1717
|
+
|
|
1718
|
+
if (best_k === -1) continue; // no unclaimed candidate at all this substep — keep frozen geometry
|
|
1671
1719
|
|
|
1672
1720
|
redetect_claimed[best_k] = 1;
|
|
1673
1721
|
const co = best_k * CANDIDATE_STRIDE;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"raycast.d.ts","sourceRoot":"","sources":["../../../../../src/engine/physics/queries/raycast.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"raycast.d.ts","sourceRoot":"","sources":["../../../../../src/engine/physics/queries/raycast.js"],"names":[],"mappings":"AA8IA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,yGAJmB,MAAM,yBAAsB,OAAO,GAEzC,OAAO,CAwCnB"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { SCRATCH_UINT32_TRAVERSAL_STACK } from "../../../core/collection/SCRATCH_UINT32_TRAVERSAL_STACK.js";
|
|
2
1
|
import {
|
|
3
2
|
COLUMN_CHILD_1,
|
|
4
3
|
COLUMN_CHILD_2,
|
|
@@ -6,9 +5,13 @@ import {
|
|
|
6
5
|
ELEMENT_WORD_COUNT,
|
|
7
6
|
NULL_NODE,
|
|
8
7
|
} from "../../../core/bvh2/bvh3/BVH.js";
|
|
8
|
+
import { SCRATCH_UINT32_TRAVERSAL_STACK } from "../../../core/collection/SCRATCH_UINT32_TRAVERSAL_STACK.js";
|
|
9
9
|
import { returnTrue } from "../../../core/function/returnTrue.js";
|
|
10
|
-
import {
|
|
11
|
-
|
|
10
|
+
import {
|
|
11
|
+
aabb3_near_distance_to_intersection_ray_segment
|
|
12
|
+
} from "../../../core/geom/3d/aabb/aabb3_near_distance_to_intersection_ray_segment.js";
|
|
13
|
+
import { body_id_index } from "../body/BodyStorage.js";
|
|
14
|
+
import { RAY_REFINE_UNSUPPORTED, refine_ray_hit } from "../narrowphase/refine_ray_hit.js";
|
|
12
15
|
|
|
13
16
|
const stack = SCRATCH_UINT32_TRAVERSAL_STACK;
|
|
14
17
|
|
|
@@ -104,7 +107,7 @@ function bvh_raycast_nearest(
|
|
|
104
107
|
const body_id = uint32[address + COLUMN_USER_DATA];
|
|
105
108
|
const entity = system.entityOf(body_id);
|
|
106
109
|
if (entity < 0) continue; // unlinked concurrently
|
|
107
|
-
const idx =
|
|
110
|
+
const idx = body_id_index(body_id);
|
|
108
111
|
const collider = system.__primary_collider(idx);
|
|
109
112
|
if (collider === null) continue;
|
|
110
113
|
if (!filter(entity, collider)) continue;
|
|
@@ -48,9 +48,9 @@ export function warm_start_contacts(manifolds: ManifoldStore, system: PhysicsSys
|
|
|
48
48
|
* for the small per-step rotation), so they are not recomputed here.
|
|
49
49
|
*
|
|
50
50
|
* @param {ManifoldStore} manifolds
|
|
51
|
-
* @param {
|
|
51
|
+
* @param {Transform[]} transforms
|
|
52
52
|
*/
|
|
53
|
-
export function refresh_contacts(manifolds: ManifoldStore,
|
|
53
|
+
export function refresh_contacts(manifolds: ManifoldStore, transforms: Transform[]): void;
|
|
54
54
|
/**
|
|
55
55
|
* Stage 2b (per substep) — the concave counterpart of {@link refresh_contacts}.
|
|
56
56
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"solve_contacts.d.ts","sourceRoot":"","sources":["../../../../../src/engine/physics/solver/solve_contacts.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"solve_contacts.d.ts","sourceRoot":"","sources":["../../../../../src/engine/physics/solver/solve_contacts.js"],"names":[],"mappings":"AA8fA;;;;;;;;;;;;;GAaG;AACH,0FAHW,MAAM,GACJ,MAAM,CA8LlB;AAED;;;;;;;;;;;;;;;GAeG;AACH,2FA0CC;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,uEAFW,WAAW,QA4FrB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,iGAsGC;AAED;;;;;;;;GAQG;AACH,uFAFW,MAAM,QA8HhB;AAED;;;;;;;;;;;GAWG;AACH,yFAuDC;AAED;;;;;;;;;;;;;;GAcG;AACH,2FAFW,MAAM,QA2EhB;AAED;;;;;;;;;;;;;;;GAeG;AACH,oFAJW,MAAM,UACN,MAAM,cACN,MAAM,QAahB;AAnuCD;;;;;GAKG;AACH,0CAFU,MAAM,CAEuB;AAEvC;;;GAGG;AACH,0CAFU,MAAM,CAEsB"}
|