@woosh/meep-engine 2.147.0 → 2.149.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/geom/3d/topology/struct/binary/io/bt_mesh_bridge_islands.d.ts +23 -0
- package/src/core/geom/3d/topology/struct/binary/io/bt_mesh_bridge_islands.d.ts.map +1 -0
- package/src/core/geom/3d/topology/struct/binary/io/bt_mesh_bridge_islands.js +295 -0
- 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/navigation/mesh/NavigationMesh.d.ts +6 -2
- package/src/engine/navigation/mesh/NavigationMesh.d.ts.map +1 -1
- package/src/engine/navigation/mesh/NavigationMesh.js +234 -212
- package/src/engine/navigation/mesh/bt_mesh_face_find_path.d.ts +7 -3
- package/src/engine/navigation/mesh/bt_mesh_face_find_path.d.ts.map +1 -1
- package/src/engine/navigation/mesh/bt_mesh_face_find_path.js +67 -73
- package/src/engine/navigation/mesh/build/enforce_agent_height_clearance.d.ts +16 -5
- package/src/engine/navigation/mesh/build/enforce_agent_height_clearance.d.ts.map +1 -1
- package/src/engine/navigation/mesh/build/enforce_agent_height_clearance.js +262 -147
- package/src/engine/navigation/mesh/build/navmesh_build_topology.d.ts.map +1 -1
- package/src/engine/navigation/mesh/build/navmesh_build_topology.js +33 -3
- package/src/engine/navigation/mesh/bvh_query_nearest_face.d.ts +4 -1
- package/src/engine/navigation/mesh/bvh_query_nearest_face.d.ts.map +1 -1
- package/src/engine/navigation/mesh/bvh_query_nearest_face.js +164 -131
- 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 +110 -108
- 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 +21 -18
- package/src/engine/physics/ecs/PhysicsSystem.d.ts.map +1 -1
- package/src/engine/physics/ecs/PhysicsSystem.js +223 -91
- 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 +4 -34
- 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 +24 -3
- package/src/engine/physics/queries/raycast.d.ts.map +1 -1
- package/src/engine/physics/queries/raycast.js +201 -198
- 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
|
@@ -1,131 +1,164 @@
|
|
|
1
|
-
import { assert } from "../../../core/assert.js";
|
|
2
|
-
import {
|
|
3
|
-
COLUMN_CHILD_1,
|
|
4
|
-
COLUMN_CHILD_2,
|
|
5
|
-
COLUMN_USER_DATA,
|
|
6
|
-
ELEMENT_WORD_COUNT,
|
|
7
|
-
NULL_NODE
|
|
8
|
-
} from "../../../core/bvh2/bvh3/BVH.js";
|
|
9
|
-
import { SCRATCH_UINT32_TRAVERSAL_STACK } from "../../../core/collection/SCRATCH_UINT32_TRAVERSAL_STACK.js";
|
|
10
|
-
import {
|
|
11
|
-
aabb3_unsigned_distance_sqr_to_point
|
|
12
|
-
} from "../../../core/geom/3d/aabb/aabb3_unsigned_distance_sqr_to_point.js";
|
|
13
|
-
import { NULL_POINTER } from "../../../core/geom/3d/topology/struct/binary/BinaryTopology.js";
|
|
14
|
-
import {
|
|
15
|
-
computeTriangleClosestPointToPointBarycentric
|
|
16
|
-
} from "../../../core/geom/3d/triangle/computeTriangleClosestPointToPointBarycentric.js";
|
|
17
|
-
|
|
18
|
-
const stack = SCRATCH_UINT32_TRAVERSAL_STACK;
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
const
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
* @param {
|
|
31
|
-
* @param {
|
|
32
|
-
* @param {number}
|
|
33
|
-
* @param {number}
|
|
34
|
-
*
|
|
35
|
-
* @param {number} [
|
|
36
|
-
* @
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
const
|
|
112
|
-
const
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
const
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
const
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
const
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
1
|
+
import { assert } from "../../../core/assert.js";
|
|
2
|
+
import {
|
|
3
|
+
COLUMN_CHILD_1,
|
|
4
|
+
COLUMN_CHILD_2,
|
|
5
|
+
COLUMN_USER_DATA,
|
|
6
|
+
ELEMENT_WORD_COUNT,
|
|
7
|
+
NULL_NODE
|
|
8
|
+
} from "../../../core/bvh2/bvh3/BVH.js";
|
|
9
|
+
import { SCRATCH_UINT32_TRAVERSAL_STACK } from "../../../core/collection/SCRATCH_UINT32_TRAVERSAL_STACK.js";
|
|
10
|
+
import {
|
|
11
|
+
aabb3_unsigned_distance_sqr_to_point
|
|
12
|
+
} from "../../../core/geom/3d/aabb/aabb3_unsigned_distance_sqr_to_point.js";
|
|
13
|
+
import { NULL_POINTER } from "../../../core/geom/3d/topology/struct/binary/BinaryTopology.js";
|
|
14
|
+
import {
|
|
15
|
+
computeTriangleClosestPointToPointBarycentric
|
|
16
|
+
} from "../../../core/geom/3d/triangle/computeTriangleClosestPointToPointBarycentric.js";
|
|
17
|
+
|
|
18
|
+
const stack = SCRATCH_UINT32_TRAVERSAL_STACK;
|
|
19
|
+
|
|
20
|
+
// single reusable coordinate scratch; callers unpack into locals between the calls that fill it
|
|
21
|
+
const scratch_coords = new Float32Array(3);
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Find the face of `mesh` whose surface is closest to the given point.
|
|
25
|
+
* Expects `bvh` to have been built by {@link bvh_build_from_bt_mesh}, so each leaf's user data is a face ID.
|
|
26
|
+
* Faces are expected to be triangles (as produced by the navmesh build pipeline).
|
|
27
|
+
*
|
|
28
|
+
* @param {BVH} bvh
|
|
29
|
+
* @param {BinaryTopology} mesh
|
|
30
|
+
* @param {number} x
|
|
31
|
+
* @param {number} y
|
|
32
|
+
* @param {number} z
|
|
33
|
+
* @param {Float32Array|number[]} out_point the closest point ON the winning face's surface (the snapped
|
|
34
|
+
* contact point) is written here when a face is found. Required, must not be null.
|
|
35
|
+
* @param {number} [out_point_offset=0] offset into `out_point` to write the snapped XYZ triple
|
|
36
|
+
* @param {number} [max_distance=Infinity] optional cutoff, only faces within this distance are considered
|
|
37
|
+
* @returns {number} face ID of the nearest face, or {@link NULL_POINTER} if no face was found within the cutoff
|
|
38
|
+
*/
|
|
39
|
+
export function bvh_query_nearest_face(
|
|
40
|
+
bvh,
|
|
41
|
+
mesh,
|
|
42
|
+
x, y, z,
|
|
43
|
+
out_point,
|
|
44
|
+
out_point_offset = 0,
|
|
45
|
+
max_distance = Infinity
|
|
46
|
+
) {
|
|
47
|
+
|
|
48
|
+
assert.defined(bvh, "bvh");
|
|
49
|
+
assert.defined(mesh, "mesh");
|
|
50
|
+
assert.notNull(out_point, "out_point");
|
|
51
|
+
assert.defined(out_point, "out_point");
|
|
52
|
+
assert.equal(mesh.isBinaryTopology, true, "mesh.isBinaryTopology !== true");
|
|
53
|
+
|
|
54
|
+
const root = bvh.root;
|
|
55
|
+
|
|
56
|
+
if (root === NULL_NODE) {
|
|
57
|
+
return NULL_POINTER;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
const stack_top = stack.pointer++;
|
|
61
|
+
|
|
62
|
+
stack[stack_top] = root;
|
|
63
|
+
|
|
64
|
+
let best_face = NULL_POINTER;
|
|
65
|
+
let best_distance_sqr = max_distance * max_distance;
|
|
66
|
+
|
|
67
|
+
// closest point on the winning face's surface, tracked so callers can snap a query point onto the mesh
|
|
68
|
+
let best_contact_x = 0;
|
|
69
|
+
let best_contact_y = 0;
|
|
70
|
+
let best_contact_z = 0;
|
|
71
|
+
|
|
72
|
+
const float32 = bvh.__data_float32;
|
|
73
|
+
const uint32 = bvh.__data_uint32;
|
|
74
|
+
|
|
75
|
+
do {
|
|
76
|
+
stack.pointer--;
|
|
77
|
+
|
|
78
|
+
const node = stack[stack.pointer];
|
|
79
|
+
const address = node * ELEMENT_WORD_COUNT;
|
|
80
|
+
|
|
81
|
+
// lower bound on distance via AABB
|
|
82
|
+
const aabb_distance_sqr = aabb3_unsigned_distance_sqr_to_point(
|
|
83
|
+
float32[address], float32[address + 1], float32[address + 2],
|
|
84
|
+
float32[address + 3], float32[address + 4], float32[address + 5],
|
|
85
|
+
x, y, z
|
|
86
|
+
);
|
|
87
|
+
|
|
88
|
+
if (aabb_distance_sqr >= best_distance_sqr) {
|
|
89
|
+
// this subtree cannot contain a closer face
|
|
90
|
+
continue;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
const child_1 = uint32[address + COLUMN_CHILD_1];
|
|
94
|
+
|
|
95
|
+
if (child_1 !== NULL_NODE) {
|
|
96
|
+
// internal node, descend into both children
|
|
97
|
+
stack[stack.pointer++] = child_1;
|
|
98
|
+
stack[stack.pointer++] = uint32[address + COLUMN_CHILD_2];
|
|
99
|
+
continue;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
// leaf node: refine with actual triangle distance
|
|
103
|
+
const face_id = uint32[address + COLUMN_USER_DATA];
|
|
104
|
+
|
|
105
|
+
const loop_a = mesh.face_read_loop(face_id);
|
|
106
|
+
|
|
107
|
+
if (loop_a === NULL_POINTER) {
|
|
108
|
+
continue;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
const loop_b = mesh.loop_read_next(loop_a);
|
|
112
|
+
const loop_c = mesh.loop_read_next(loop_b);
|
|
113
|
+
|
|
114
|
+
// read each vertex into the shared scratch, unpacking into locals before the next read overwrites it
|
|
115
|
+
mesh.vertex_read_coordinate(scratch_coords, 0, mesh.loop_read_vertex(loop_a));
|
|
116
|
+
const ax = scratch_coords[0], ay = scratch_coords[1], az = scratch_coords[2];
|
|
117
|
+
|
|
118
|
+
mesh.vertex_read_coordinate(scratch_coords, 0, mesh.loop_read_vertex(loop_b));
|
|
119
|
+
const bx = scratch_coords[0], by = scratch_coords[1], bz = scratch_coords[2];
|
|
120
|
+
|
|
121
|
+
mesh.vertex_read_coordinate(scratch_coords, 0, mesh.loop_read_vertex(loop_c));
|
|
122
|
+
const cx = scratch_coords[0], cy = scratch_coords[1], cz = scratch_coords[2];
|
|
123
|
+
|
|
124
|
+
// reuse the same scratch for the barycentric output (only the first two slots are written)
|
|
125
|
+
computeTriangleClosestPointToPointBarycentric(
|
|
126
|
+
scratch_coords, 0,
|
|
127
|
+
x, y, z,
|
|
128
|
+
ax, ay, az,
|
|
129
|
+
bx, by, bz,
|
|
130
|
+
cx, cy, cz
|
|
131
|
+
);
|
|
132
|
+
|
|
133
|
+
const weight_a = scratch_coords[0];
|
|
134
|
+
const weight_b = scratch_coords[1];
|
|
135
|
+
const weight_c = 1 - weight_a - weight_b;
|
|
136
|
+
|
|
137
|
+
const contact_x = ax * weight_a + bx * weight_b + cx * weight_c;
|
|
138
|
+
const contact_y = ay * weight_a + by * weight_b + cy * weight_c;
|
|
139
|
+
const contact_z = az * weight_a + bz * weight_b + cz * weight_c;
|
|
140
|
+
|
|
141
|
+
const dx = contact_x - x;
|
|
142
|
+
const dy = contact_y - y;
|
|
143
|
+
const dz = contact_z - z;
|
|
144
|
+
|
|
145
|
+
const triangle_distance_sqr = dx * dx + dy * dy + dz * dz;
|
|
146
|
+
|
|
147
|
+
if (triangle_distance_sqr < best_distance_sqr) {
|
|
148
|
+
best_distance_sqr = triangle_distance_sqr;
|
|
149
|
+
best_face = face_id;
|
|
150
|
+
|
|
151
|
+
best_contact_x = contact_x;
|
|
152
|
+
best_contact_y = contact_y;
|
|
153
|
+
best_contact_z = contact_z;
|
|
154
|
+
}
|
|
155
|
+
} while (stack.pointer > stack_top);
|
|
156
|
+
|
|
157
|
+
if (best_face !== NULL_POINTER) {
|
|
158
|
+
out_point[out_point_offset] = best_contact_x;
|
|
159
|
+
out_point[out_point_offset + 1] = best_contact_y;
|
|
160
|
+
out_point[out_point_offset + 2] = best_contact_z;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
return best_face;
|
|
164
|
+
}
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* # SolverBodyState — data-oriented mirror of the per-body solver hot state
|
|
3
|
+
*
|
|
4
|
+
* The TGS substep window (contact solver, joint solver, gravity / position
|
|
5
|
+
* integration) reads and writes a small, fixed set of per-body quantities
|
|
6
|
+
* thousands of times per step: linear / angular velocity, inverse mass,
|
|
7
|
+
* inverse-inertia diagonal, and orientation. In the object world those live on
|
|
8
|
+
* the {@link RigidBody} and {@link Transform} *components*, reached via
|
|
9
|
+
* `system.__bodies[idx]` / `system.__transforms[idx]` — a chain of pointer
|
|
10
|
+
* dereferences (array → component object → `Vector3` field) on the hottest
|
|
11
|
+
* inner loop in the engine.
|
|
12
|
+
*
|
|
13
|
+
* This class packs exactly those quantities into one ArrayBuffer-backed,
|
|
14
|
+
* stride-{@link SBS_STRIDE} `Float64Array` indexed by **body slot index** (the
|
|
15
|
+
* same index the rest of the physics system already uses). A body's whole
|
|
16
|
+
* solver state sits in one contiguous span, so the solver reads it with flat
|
|
17
|
+
* typed-array indexing and no object dereference.
|
|
18
|
+
*
|
|
19
|
+
* ## Lifecycle within one `fixedUpdate`
|
|
20
|
+
*
|
|
21
|
+
* - {@link begin} once, after islands are built: ensures capacity and rolls
|
|
22
|
+
* the per-step gather stamp.
|
|
23
|
+
* - {@link gather} every body referenced this step (the awake set + the
|
|
24
|
+
* static / kinematic anchors referenced by contacts and joints). Idempotent
|
|
25
|
+
* per step via the stamp, so callers may gather the same body redundantly.
|
|
26
|
+
* MUST run after the once-per-step force integration (so the gathered
|
|
27
|
+
* velocity is post-force) and before any substep stage reads it.
|
|
28
|
+
* - the substep loop mutates `data` in place.
|
|
29
|
+
* - {@link scatter} once at the end: write the persistent linear / angular
|
|
30
|
+
* velocity back to each gathered body's `RigidBody`. Pose is NOT scattered
|
|
31
|
+
* here — `integrate_position` keeps the authoritative pose on the
|
|
32
|
+
* `Transform` (write-through, so its `onChanged` subscribers and the
|
|
33
|
+
* per-substep concave re-detection still see the moved pose); the
|
|
34
|
+
* orientation quaternion is mirrored into `data` purely for the impulse
|
|
35
|
+
* loop's world-inverse-inertia evaluation.
|
|
36
|
+
*
|
|
37
|
+
* ## Material content
|
|
38
|
+
*
|
|
39
|
+
* For Static / Kinematic bodies `invMass` and the inverse-inertia diagonal are
|
|
40
|
+
* stored as **zero** regardless of the component values — the solver treats
|
|
41
|
+
* "no inverse mass / no inverse inertia" as immovable, which is exactly how the
|
|
42
|
+
* object path's `kind !== Dynamic` guards behave. Velocity is mirrored as-is
|
|
43
|
+
* (a kinematic mover carries a real velocity the contact rows must see; a
|
|
44
|
+
* static reads zero). Scattering velocity back to a non-dynamic body is a
|
|
45
|
+
* no-op in value (the solver never moves it), so scatter need not special-case.
|
|
46
|
+
*
|
|
47
|
+
* The arithmetic the solver performs on this data is identical to the object
|
|
48
|
+
* path — only the *source of the operands* changes — so the engine's
|
|
49
|
+
* same-runtime bit-identical determinism contract is preserved.
|
|
50
|
+
*
|
|
51
|
+
* @author Alex Goldring
|
|
52
|
+
* @copyright Company Named Limited (c) 2026
|
|
53
|
+
*/
|
|
54
|
+
/** Inverse mass (0 for Static / Kinematic). */
|
|
55
|
+
export const SBS_INV_MASS: 0;
|
|
56
|
+
/** Inverse-inertia diagonal, body-local principal frame (0,0,0 for non-dynamic). */
|
|
57
|
+
export const SBS_INV_I_X: 1;
|
|
58
|
+
export const SBS_INV_I_Y: 2;
|
|
59
|
+
export const SBS_INV_I_Z: 3;
|
|
60
|
+
/** Orientation quaternion (mirrors `transform.rotation`, refreshed per substep). */
|
|
61
|
+
export const SBS_QX: 4;
|
|
62
|
+
export const SBS_QY: 5;
|
|
63
|
+
export const SBS_QZ: 6;
|
|
64
|
+
export const SBS_QW: 7;
|
|
65
|
+
/** Persistent linear velocity. */
|
|
66
|
+
export const SBS_LV_X: 8;
|
|
67
|
+
export const SBS_LV_Y: 9;
|
|
68
|
+
export const SBS_LV_Z: 10;
|
|
69
|
+
/** Persistent angular velocity. */
|
|
70
|
+
export const SBS_AV_X: 11;
|
|
71
|
+
export const SBS_AV_Y: 12;
|
|
72
|
+
export const SBS_AV_Z: 13;
|
|
73
|
+
/** Doubles per body. */
|
|
74
|
+
export const SBS_STRIDE: 14;
|
|
75
|
+
export class SolverBodyState {
|
|
76
|
+
constructor(initial_capacity?: number);
|
|
77
|
+
/**
|
|
78
|
+
* Interleaved per-body state, `slot_index * SBS_STRIDE + field`.
|
|
79
|
+
* @type {Float64Array}
|
|
80
|
+
*/
|
|
81
|
+
data: Float64Array;
|
|
82
|
+
/**
|
|
83
|
+
* Per-body "gathered this step" stamp; equals {@link __gen} when the
|
|
84
|
+
* body's slot has been gathered in the current step.
|
|
85
|
+
* @private
|
|
86
|
+
* @type {Int32Array}
|
|
87
|
+
*/
|
|
88
|
+
private __stamp;
|
|
89
|
+
/**
|
|
90
|
+
* Dense list of slot indices gathered this step, for {@link scatter}.
|
|
91
|
+
* @private
|
|
92
|
+
* @type {Uint32Array}
|
|
93
|
+
*/
|
|
94
|
+
private __gathered;
|
|
95
|
+
/** @private */
|
|
96
|
+
private __gathered_count;
|
|
97
|
+
/**
|
|
98
|
+
* Monotonic per-step generation. {@link begin} increments it so the
|
|
99
|
+
* previous step's stamps are stale without an O(n) clear.
|
|
100
|
+
* @private
|
|
101
|
+
*/
|
|
102
|
+
private __gen;
|
|
103
|
+
/** @private */
|
|
104
|
+
private __capacity;
|
|
105
|
+
/**
|
|
106
|
+
* Number of bodies gathered in the current step.
|
|
107
|
+
* @returns {number}
|
|
108
|
+
*/
|
|
109
|
+
get gathered_count(): number;
|
|
110
|
+
/**
|
|
111
|
+
* Ensure the typed arrays can index slot `[0, hwm)` and roll the per-step
|
|
112
|
+
* gather state. Call once per `fixedUpdate`, after islands are built.
|
|
113
|
+
*
|
|
114
|
+
* @param {number} hwm body-storage high-water mark
|
|
115
|
+
*/
|
|
116
|
+
begin(hwm: number): void;
|
|
117
|
+
/**
|
|
118
|
+
* Mirror one body's solver state into `data` if not already gathered this
|
|
119
|
+
* step. Idempotent per step. Reads the body's current (post-force)
|
|
120
|
+
* velocity and current pose.
|
|
121
|
+
*
|
|
122
|
+
* @param {number} idx body slot index
|
|
123
|
+
* @param {RigidBody} rb
|
|
124
|
+
* @param {Transform} transform
|
|
125
|
+
*/
|
|
126
|
+
gather(idx: number, rb: RigidBody, transform: Transform): void;
|
|
127
|
+
/**
|
|
128
|
+
* Write the solved persistent linear / angular velocity back onto every
|
|
129
|
+
* gathered body's `RigidBody`. Direct typed-array writes into the
|
|
130
|
+
* `Vector3` backing — the same observer-bypassing path the solver already
|
|
131
|
+
* uses for velocity (`lv[0] += …`), so no `onChanged` semantics change.
|
|
132
|
+
*
|
|
133
|
+
* @param {RigidBody[]} bodies sparse, indexed by slot
|
|
134
|
+
*/
|
|
135
|
+
scatter(bodies: RigidBody[]): void;
|
|
136
|
+
/**
|
|
137
|
+
* @private
|
|
138
|
+
* @param {number} hwm
|
|
139
|
+
*/
|
|
140
|
+
private __grow;
|
|
141
|
+
}
|
|
142
|
+
//# sourceMappingURL=SolverBodyState.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SolverBodyState.d.ts","sourceRoot":"","sources":["../../../../../src/engine/physics/body/SolverBodyState.js"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoDG;AAEH,+CAA+C;AAC/C,6BAA8B;AAC9B,oFAAoF;AACpF,4BAA6B;AAC7B,4BAA6B;AAC7B,4BAA6B;AAC7B,oFAAoF;AACpF,uBAAwB;AACxB,uBAAwB;AACxB,uBAAwB;AACxB,uBAAwB;AACxB,kCAAkC;AAClC,yBAA0B;AAC1B,yBAA0B;AAC1B,0BAA2B;AAC3B,mCAAmC;AACnC,0BAA2B;AAC3B,0BAA2B;AAC3B,0BAA2B;AAE3B,wBAAwB;AACxB,4BAA6B;AAE7B;IACI,uCAoCC;IAjCG;;;OAGG;IACH,MAFU,YAAY,CAEwB;IAE9C;;;;;OAKG;IACH,gBAAkC;IAElC;;;;OAIG;IACH,mBAAsC;IAEtC,eAAe;IACf,yBAAyB;IAEzB;;;;OAIG;IACH,cAAc;IAEd,eAAe;IACf,mBAAqB;IAGzB;;;OAGG;IACH,6BAEC;IAED;;;;;OAKG;IACH,WAFW,MAAM,QAiBhB;IAED;;;;;;;;OAQG;IACH,YAJW,MAAM,6CA8ChB;IAED;;;;;;;OAOG;IACH,gBAFW,WAAW,QAoBrB;IAED;;;OAGG;IACH,eAcC;CACJ"}
|