@woosh/meep-engine 2.139.0 → 2.140.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/bvh2/bvh3/query/bvh_query_user_data_overlaps_aabb.d.ts +3 -3
- package/src/core/bvh2/bvh3/query/bvh_query_user_data_overlaps_aabb.d.ts.map +1 -1
- package/src/core/bvh2/bvh3/query/bvh_query_user_data_overlaps_aabb.js +4 -4
- package/src/{engine/physics/broadphase/aabb_transform_oriented.d.ts → core/geom/3d/aabb/aabb3_transform_oriented.d.ts} +2 -2
- package/src/core/geom/3d/aabb/aabb3_transform_oriented.d.ts.map +1 -0
- package/src/{engine/physics/broadphase/aabb_transform_oriented.js → core/geom/3d/aabb/aabb3_transform_oriented.js} +1 -1
- package/src/core/geom/3d/quaternion/quat3_to_matrix3.d.ts +54 -0
- package/src/core/geom/3d/quaternion/quat3_to_matrix3.d.ts.map +1 -0
- package/src/core/geom/3d/quaternion/quat3_to_matrix3.js +69 -0
- package/src/core/geom/3d/shape/AbstractShape3D.d.ts +24 -2
- package/src/core/geom/3d/shape/AbstractShape3D.d.ts.map +1 -1
- package/src/core/geom/3d/shape/AbstractShape3D.js +24 -1
- package/src/core/geom/3d/shape/HeightMapShape3D.d.ts +148 -0
- package/src/core/geom/3d/shape/HeightMapShape3D.d.ts.map +1 -0
- package/src/core/geom/3d/shape/HeightMapShape3D.js +451 -0
- package/src/core/geom/3d/shape/MeshShape3D.d.ts +210 -0
- package/src/core/geom/3d/shape/MeshShape3D.d.ts.map +1 -0
- package/src/core/geom/3d/shape/MeshShape3D.js +593 -0
- package/src/core/geom/3d/shape/TransformedShape3D.d.ts.map +1 -1
- package/src/core/geom/3d/shape/TransformedShape3D.js +46 -2
- package/src/core/geom/3d/shape/Triangle3D.d.ts +95 -0
- package/src/core/geom/3d/shape/Triangle3D.d.ts.map +1 -0
- package/src/core/geom/3d/shape/Triangle3D.js +318 -0
- package/src/core/geom/3d/shape/UnionShape3D.js +13 -0
- package/src/core/geom/3d/shape/shape_mesh_from_geometry.d.ts +30 -0
- package/src/core/geom/3d/shape/shape_mesh_from_geometry.d.ts.map +1 -0
- package/src/core/geom/3d/shape/shape_mesh_from_geometry.js +64 -0
- package/src/core/geom/3d/tetrahedra/prototype_tetrahedrize_mesh.js +9 -11
- package/src/core/geom/3d/tetrahedra/tetrahedral_mesh_build_vertex_to_tets_map.d.ts +28 -0
- package/src/core/geom/3d/tetrahedra/tetrahedral_mesh_build_vertex_to_tets_map.d.ts.map +1 -0
- package/src/core/geom/3d/tetrahedra/tetrahedral_mesh_build_vertex_to_tets_map.js +48 -0
- package/src/core/geom/3d/tetrahedra/tetrahedral_mesh_improve_quality.d.ts.map +1 -1
- package/src/core/geom/3d/tetrahedra/tetrahedral_mesh_improve_quality.js +40 -18
- package/src/core/geom/3d/tetrahedra/tetrahedral_mesh_smooth_vertex.d.ts +9 -5
- package/src/core/geom/3d/tetrahedra/tetrahedral_mesh_smooth_vertex.d.ts.map +1 -1
- package/src/core/geom/3d/tetrahedra/tetrahedral_mesh_smooth_vertex.js +38 -10
- package/src/core/geom/3d/tetrahedra/tetrahedral_mesh_vertex_is_boundary.d.ts +14 -5
- package/src/core/geom/3d/tetrahedra/tetrahedral_mesh_vertex_is_boundary.d.ts.map +1 -1
- package/src/core/geom/3d/tetrahedra/tetrahedral_mesh_vertex_is_boundary.js +47 -5
- package/src/core/geom/3d/topology/struct/binary/BinaryElementPool.d.ts +19 -0
- package/src/core/geom/3d/topology/struct/binary/BinaryElementPool.d.ts.map +1 -1
- package/src/core/geom/3d/topology/struct/binary/BinaryElementPool.js +75 -13
- package/src/core/geom/3d/triangle/v3_compute_triangle_normal.d.ts +2 -2
- package/src/core/geom/3d/triangle/v3_compute_triangle_normal.d.ts.map +1 -1
- package/src/core/geom/3d/triangle/v3_compute_triangle_normal.js +1 -1
- package/src/core/geom/vec3/v3_dot_array_array.d.ts +3 -3
- package/src/core/geom/vec3/v3_dot_array_array.d.ts.map +1 -1
- package/src/core/geom/vec3/v3_dot_array_array.js +2 -2
- package/src/core/geom/vec3/v3_negate_array.d.ts +3 -3
- package/src/core/geom/vec3/v3_negate_array.d.ts.map +1 -1
- package/src/core/geom/vec3/v3_negate_array.js +2 -2
- package/src/core/geom/vec3/v3_quat3_apply.d.ts +29 -0
- package/src/core/geom/vec3/v3_quat3_apply.d.ts.map +1 -0
- package/src/core/geom/vec3/v3_quat3_apply.js +39 -0
- package/src/core/geom/vec3/v3_quat3_apply_inverse.d.ts +30 -0
- package/src/core/geom/vec3/v3_quat3_apply_inverse.d.ts.map +1 -0
- package/src/core/geom/vec3/v3_quat3_apply_inverse.js +41 -0
- package/src/core/geom/vec3/v3_triple_cross_product.d.ts +32 -0
- package/src/core/geom/vec3/v3_triple_cross_product.d.ts.map +1 -0
- package/src/core/geom/vec3/v3_triple_cross_product.js +45 -0
- package/src/engine/control/first-person/FirstPersonPlayerController.d.ts +16 -3
- package/src/engine/control/first-person/FirstPersonPlayerController.d.ts.map +1 -1
- package/src/engine/control/first-person/FirstPersonPlayerController.js +211 -211
- package/src/engine/control/first-person/FirstPersonPlayerControllerConfig.d.ts +72 -8
- package/src/engine/control/first-person/FirstPersonPlayerControllerConfig.d.ts.map +1 -1
- package/src/engine/control/first-person/FirstPersonPlayerControllerConfig.js +37 -5
- package/src/engine/control/first-person/FirstPersonPlayerControllerSystem.d.ts +101 -3
- package/src/engine/control/first-person/FirstPersonPlayerControllerSystem.d.ts.map +1 -1
- package/src/engine/control/first-person/FirstPersonPlayerControllerSystem.js +1789 -1416
- package/src/engine/control/first-person/TODO.md +173 -127
- package/src/engine/control/first-person/abilities/Slide.d.ts.map +1 -1
- package/src/engine/control/first-person/abilities/Slide.js +9 -1
- package/src/engine/control/first-person/prototype_first_person_controller.js +88 -2
- package/src/engine/control/first-person/test/buildTestPlayer.d.ts.map +1 -1
- package/src/engine/control/first-person/test/buildTestPlayer.js +9 -1
- package/src/engine/graphics/geometry/CapsuleGeometry.d.ts +42 -0
- package/src/engine/graphics/geometry/CapsuleGeometry.d.ts.map +1 -0
- package/src/engine/graphics/geometry/CapsuleGeometry.js +171 -0
- package/src/engine/physics/BULLET_REVIEW.md +945 -0
- package/src/engine/physics/CANNON_REVIEW.md +1300 -0
- package/src/engine/physics/JOLT_REVIEW.md +913 -0
- package/src/engine/physics/PLAN.md +461 -236
- package/src/engine/physics/RAPIER_REVIEW.md +934 -0
- package/src/engine/physics/REVIEW_001_ACTION_PLAN.md +642 -0
- package/src/engine/physics/broadphase/compute_fat_world_aabb.js +2 -2
- package/src/engine/physics/contact/ManifoldStore.d.ts +83 -10
- package/src/engine/physics/contact/ManifoldStore.d.ts.map +1 -1
- package/src/engine/physics/contact/ManifoldStore.js +608 -499
- package/src/engine/physics/ecs/ColliderObserverSystem.d.ts +2 -2
- package/src/engine/physics/ecs/ColliderObserverSystem.d.ts.map +1 -1
- package/src/engine/physics/ecs/PhysicsSystem.d.ts +128 -20
- package/src/engine/physics/ecs/PhysicsSystem.d.ts.map +1 -1
- package/src/engine/physics/ecs/PhysicsSystem.js +1301 -1159
- package/src/engine/physics/fluid/FluidSimulator.d.ts.map +1 -1
- package/src/engine/physics/fluid/FluidSimulator.js +2 -1
- package/src/engine/physics/fluid/solver/v3_grid_subtract_pressure_gradient.d.ts +28 -6
- package/src/engine/physics/fluid/solver/v3_grid_subtract_pressure_gradient.d.ts.map +1 -1
- package/src/engine/physics/fluid/solver/v3_grid_subtract_pressure_gradient.js +39 -17
- package/src/engine/physics/gjk/expanding_polytope_algorithm.d.ts +6 -6
- package/src/engine/physics/gjk/expanding_polytope_algorithm.d.ts.map +1 -1
- package/src/engine/physics/gjk/expanding_polytope_algorithm.js +68 -22
- package/src/engine/physics/gjk/gjk.d.ts +28 -2
- package/src/engine/physics/gjk/gjk.d.ts.map +1 -1
- package/src/engine/physics/gjk/gjk.js +421 -378
- package/src/engine/physics/gjk/minkowski_support.d.ts +37 -0
- package/src/engine/physics/gjk/minkowski_support.d.ts.map +1 -0
- package/src/engine/physics/gjk/minkowski_support.js +75 -0
- package/src/engine/physics/gjk/mpr.d.ts +56 -0
- package/src/engine/physics/gjk/mpr.d.ts.map +1 -0
- package/src/engine/physics/gjk/mpr.js +344 -0
- package/src/engine/physics/inertia/world_inverse_inertia.d.ts +20 -5
- package/src/engine/physics/inertia/world_inverse_inertia.d.ts.map +1 -1
- package/src/engine/physics/inertia/world_inverse_inertia.js +36 -38
- package/src/engine/physics/integration/integrate_position.d.ts +25 -7
- package/src/engine/physics/integration/integrate_position.d.ts.map +1 -1
- package/src/engine/physics/integration/integrate_position.js +43 -12
- package/src/engine/physics/integration/integrate_velocity.d.ts +30 -0
- package/src/engine/physics/integration/integrate_velocity.d.ts.map +1 -1
- package/src/engine/physics/integration/integrate_velocity.js +82 -1
- package/src/engine/physics/narrowphase/PosedShape.d.ts +0 -8
- package/src/engine/physics/narrowphase/PosedShape.d.ts.map +1 -1
- package/src/engine/physics/narrowphase/PosedShape.js +28 -30
- package/src/engine/physics/narrowphase/box_box_manifold.d.ts.map +1 -1
- package/src/engine/physics/narrowphase/box_box_manifold.js +113 -17
- package/src/engine/physics/narrowphase/box_triangle_contact.d.ts +30 -0
- package/src/engine/physics/narrowphase/box_triangle_contact.d.ts.map +1 -0
- package/src/engine/physics/narrowphase/box_triangle_contact.js +811 -0
- package/src/engine/physics/narrowphase/capsule_contacts.d.ts.map +1 -1
- package/src/engine/physics/narrowphase/capsule_contacts.js +10 -56
- package/src/engine/physics/narrowphase/capsule_triangle_contact.d.ts +71 -0
- package/src/engine/physics/narrowphase/capsule_triangle_contact.d.ts.map +1 -0
- package/src/engine/physics/narrowphase/capsule_triangle_contact.js +375 -0
- package/src/engine/physics/narrowphase/compute_penetration.d.ts +91 -0
- package/src/engine/physics/narrowphase/compute_penetration.d.ts.map +1 -0
- package/src/engine/physics/narrowphase/compute_penetration.js +396 -0
- package/src/engine/physics/narrowphase/decomposition/aabb_world_to_local.d.ts +35 -0
- package/src/engine/physics/narrowphase/decomposition/aabb_world_to_local.d.ts.map +1 -0
- package/src/engine/physics/narrowphase/decomposition/aabb_world_to_local.js +80 -0
- package/src/engine/physics/narrowphase/decomposition/decompose_to_triangles.d.ts +31 -0
- package/src/engine/physics/narrowphase/decomposition/decompose_to_triangles.d.ts.map +1 -0
- package/src/engine/physics/narrowphase/decomposition/decompose_to_triangles.js +55 -0
- package/src/engine/physics/narrowphase/decomposition/heightmap_enumerate_triangles.d.ts +42 -0
- package/src/engine/physics/narrowphase/decomposition/heightmap_enumerate_triangles.d.ts.map +1 -0
- package/src/engine/physics/narrowphase/decomposition/heightmap_enumerate_triangles.js +204 -0
- package/src/engine/physics/narrowphase/decomposition/mesh_enumerate_triangles.d.ts +42 -0
- package/src/engine/physics/narrowphase/decomposition/mesh_enumerate_triangles.d.ts.map +1 -0
- package/src/engine/physics/narrowphase/decomposition/mesh_enumerate_triangles.js +94 -0
- package/src/engine/physics/narrowphase/decomposition/triangle_buffer_layout.d.ts +37 -0
- package/src/engine/physics/narrowphase/decomposition/triangle_buffer_layout.d.ts.map +1 -0
- package/src/engine/physics/narrowphase/decomposition/triangle_buffer_layout.js +37 -0
- package/src/engine/physics/narrowphase/narrowphase_step.d.ts +8 -2
- package/src/engine/physics/narrowphase/narrowphase_step.d.ts.map +1 -1
- package/src/engine/physics/narrowphase/narrowphase_step.js +1422 -382
- package/src/engine/physics/narrowphase/sphere_box_contact.d.ts.map +1 -1
- package/src/engine/physics/narrowphase/sphere_box_contact.js +16 -23
- package/src/engine/physics/narrowphase/sphere_triangle_contact.d.ts +48 -0
- package/src/engine/physics/narrowphase/sphere_triangle_contact.d.ts.map +1 -0
- package/src/engine/physics/narrowphase/sphere_triangle_contact.js +143 -0
- package/src/engine/physics/queries/overlap_shape.d.ts +51 -0
- package/src/engine/physics/queries/overlap_shape.d.ts.map +1 -0
- package/src/engine/physics/queries/overlap_shape.js +183 -0
- package/src/engine/physics/queries/shape_cast.d.ts +56 -0
- package/src/engine/physics/queries/shape_cast.d.ts.map +1 -0
- package/src/engine/physics/queries/shape_cast.js +387 -0
- package/src/engine/physics/solver/solve_contacts.d.ts +116 -30
- package/src/engine/physics/solver/solve_contacts.d.ts.map +1 -1
- package/src/engine/physics/solver/solve_contacts.js +641 -223
- package/src/engine/physics/broadphase/aabb_transform_oriented.d.ts.map +0 -1
- package/src/engine/physics/fluid/solver/v3_grid_solve_pressure_unmasked_legacy.d.ts +0 -20
- package/src/engine/physics/fluid/solver/v3_grid_solve_pressure_unmasked_legacy.d.ts.map +0 -1
- package/src/engine/physics/fluid/solver/v3_grid_solve_pressure_unmasked_legacy.js +0 -83
|
@@ -25,7 +25,7 @@ export class ColliderObserverSystem extends System<any, any, any, any, any> {
|
|
|
25
25
|
/** @type {PhysicsSystem} */
|
|
26
26
|
__physics: PhysicsSystem;
|
|
27
27
|
dependencies: (typeof Transform | typeof Collider)[];
|
|
28
|
-
components_used: (ResourceAccessSpecification<typeof
|
|
28
|
+
components_used: (ResourceAccessSpecification<typeof RigidBody> | ResourceAccessSpecification<typeof Collider> | ResourceAccessSpecification<typeof Transform> | ResourceAccessSpecification<typeof ParentEntity>)[];
|
|
29
29
|
/**
|
|
30
30
|
* @param {Collider} collider
|
|
31
31
|
* @param {Transform} transform
|
|
@@ -52,7 +52,7 @@ export class ColliderObserverSystem extends System<any, any, any, any, any> {
|
|
|
52
52
|
import { System } from "../../ecs/System.js";
|
|
53
53
|
import { Transform } from "../../ecs/transform/Transform.js";
|
|
54
54
|
import { Collider } from "./Collider.js";
|
|
55
|
-
import { ResourceAccessSpecification } from "../../../core/model/ResourceAccessSpecification.js";
|
|
56
55
|
import { RigidBody } from "./RigidBody.js";
|
|
56
|
+
import { ResourceAccessSpecification } from "../../../core/model/ResourceAccessSpecification.js";
|
|
57
57
|
import { ParentEntity } from "../../ecs/parent/ParentEntity.js";
|
|
58
58
|
//# sourceMappingURL=ColliderObserverSystem.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ColliderObserverSystem.d.ts","sourceRoot":"","sources":["../../../../../src/engine/physics/ecs/ColliderObserverSystem.js"],"names":[],"mappings":"AAQA;;;;;;;;;;;;;;;;;;GAkBG;AACH;IAEI;;OAEG;IACH,0CAcC;IAXG,4BAA4B;IAC5B,yBAA8B;IAE9B,qDAAyC;IAEzC,qNAKC;IAGL;;;;OAIG;IACH,eAJW,QAAQ,aACR,SAAS,UACT,MAAM,QAYhB;IAED;;;;OAIG;IACH,iBAJW,QAAQ,aACR,SAAS,UACT,MAAM,QAYhB;IAED;;;;;;;;OAQG;IACH,8BAUC;CACJ;uBAnGsB,qBAAqB;0BAClB,kCAAkC;yBACnC,eAAe;
|
|
1
|
+
{"version":3,"file":"ColliderObserverSystem.d.ts","sourceRoot":"","sources":["../../../../../src/engine/physics/ecs/ColliderObserverSystem.js"],"names":[],"mappings":"AAQA;;;;;;;;;;;;;;;;;;GAkBG;AACH;IAEI;;OAEG;IACH,0CAcC;IAXG,4BAA4B;IAC5B,yBAA8B;IAE9B,qDAAyC;IAEzC,qNAKC;IAGL;;;;OAIG;IACH,eAJW,QAAQ,aACR,SAAS,UACT,MAAM,QAYhB;IAED;;;;OAIG;IACH,iBAJW,QAAQ,aACR,SAAS,UACT,MAAM,QAYhB;IAED;;;;;;;;OAQG;IACH,8BAUC;CACJ;uBAnGsB,qBAAqB;0BAClB,kCAAkC;yBACnC,eAAe;0BACd,gBAAgB;4CAJE,oDAAoD;6BAFnE,kCAAkC"}
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
export class PhysicsSystem extends System<any, any, any, any, any> {
|
|
19
19
|
constructor();
|
|
20
20
|
dependencies: (typeof Transform | typeof RigidBody)[];
|
|
21
|
-
components_used: (ResourceAccessSpecification<typeof
|
|
21
|
+
components_used: (ResourceAccessSpecification<typeof RigidBody> | ResourceAccessSpecification<typeof Collider> | ResourceAccessSpecification<typeof Transform>)[];
|
|
22
22
|
/**
|
|
23
23
|
* @type {BodyStorage}
|
|
24
24
|
*/
|
|
@@ -66,34 +66,36 @@ export class PhysicsSystem extends System<any, any, any, any, any> {
|
|
|
66
66
|
*/
|
|
67
67
|
sleepVelocitySqrThreshold: number;
|
|
68
68
|
/**
|
|
69
|
-
*
|
|
70
|
-
*
|
|
71
|
-
*
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
*
|
|
69
|
+
* Seconds of below-threshold motion before a body is moved to the
|
|
70
|
+
* sleeping set. Box2D default is 0.5 s.
|
|
71
|
+
* @type {number}
|
|
72
|
+
*/
|
|
73
|
+
sleepTimeThreshold: number;
|
|
74
|
+
/**
|
|
75
|
+
* Number of TGS substeps per `fixedUpdate`. Each substep re-runs the
|
|
76
|
+
* velocity + position solve at `dt / substeps` against contacts whose
|
|
77
|
+
* penetration is re-derived analytically from the bodies' moved poses
|
|
78
|
+
* — narrowphase still runs once per outer step. Higher counts buy
|
|
79
|
+
* stack stability, high-mass-ratio robustness, and smoother
|
|
80
|
+
* trajectories at a near-linear solver cost (sleeping islands are
|
|
81
|
+
* unaffected — they never enter the loop).
|
|
76
82
|
*
|
|
77
|
-
*
|
|
78
|
-
* classic PGS behaviour (one solve per tick at full `dt`).
|
|
83
|
+
* `1` reproduces the non-substepped (single-step) solve.
|
|
79
84
|
* @type {number}
|
|
80
85
|
*/
|
|
81
|
-
|
|
86
|
+
substeps: number;
|
|
82
87
|
/**
|
|
83
|
-
* Velocity iterations
|
|
84
|
-
*
|
|
85
|
-
*
|
|
86
|
-
* across substeps with position integration between them, which
|
|
87
|
-
* is dramatically more stable on stacks.
|
|
88
|
+
* Velocity iterations per substep. Lower than a single-step solver
|
|
89
|
+
* would need, because the substep loop revisits the contact set
|
|
90
|
+
* `substeps` times.
|
|
88
91
|
* @type {number}
|
|
89
92
|
*/
|
|
90
|
-
|
|
93
|
+
velocityIterations: number;
|
|
91
94
|
/**
|
|
92
|
-
*
|
|
93
|
-
* sleeping set. Box2D default is 0.5 s.
|
|
95
|
+
* Position (split-impulse) iterations per substep.
|
|
94
96
|
* @type {number}
|
|
95
97
|
*/
|
|
96
|
-
|
|
98
|
+
positionIterations: number;
|
|
97
99
|
/**
|
|
98
100
|
* Reusable contact-event payload. Listeners must copy any fields they
|
|
99
101
|
* intend to retain past their own scope. Reset before each dispatch.
|
|
@@ -155,6 +157,24 @@ export class PhysicsSystem extends System<any, any, any, any, any> {
|
|
|
155
157
|
entity: number;
|
|
156
158
|
bvhNode: number;
|
|
157
159
|
}>>;
|
|
160
|
+
/**
|
|
161
|
+
* Per-body pseudo-velocity for the Catto split-impulse position
|
|
162
|
+
* pass (TGS Phase 1). Flat layout, 6 doubles per body slot index:
|
|
163
|
+
* `[lin.x, lin.y, lin.z, ang.x, ang.y, ang.z]`. Sized to
|
|
164
|
+
* `storage.high_water_mark * 6` at the top of each fixedUpdate
|
|
165
|
+
* and zeroed in place so unwritten slots contribute nothing to
|
|
166
|
+
* `integrate_position`.
|
|
167
|
+
*
|
|
168
|
+
* The solver writes during its position pass; `integrate_position`
|
|
169
|
+
* reads and folds into the pose update on the same tick, then
|
|
170
|
+
* the next tick's zero-pass wipes the state. It NEVER lands in
|
|
171
|
+
* `linearVelocity` / `angularVelocity` — that's the point of
|
|
172
|
+
* split impulse: depth correction does not contaminate persistent
|
|
173
|
+
* velocity (so a `restitution = 0` impact stops cleanly).
|
|
174
|
+
*
|
|
175
|
+
* @type {Float64Array}
|
|
176
|
+
*/
|
|
177
|
+
__pseudo_velocity: Float64Array;
|
|
158
178
|
/**
|
|
159
179
|
* Bound reference to {@link __pair_filter} so we hand the same
|
|
160
180
|
* callable to {@link generate_pairs} each step without per-step
|
|
@@ -188,6 +208,18 @@ export class PhysicsSystem extends System<any, any, any, any, any> {
|
|
|
188
208
|
* @returns {Collider|null}
|
|
189
209
|
*/
|
|
190
210
|
private __primary_collider;
|
|
211
|
+
/**
|
|
212
|
+
* Resize {@link __pseudo_velocity} to cover every live body slot and
|
|
213
|
+
* zero its contents. Called at the top of each fixedUpdate so the
|
|
214
|
+
* split-impulse position pass starts from a clean state — bodies the
|
|
215
|
+
* solver doesn't touch contribute zero pseudo-velocity to
|
|
216
|
+
* {@link integrate_position}.
|
|
217
|
+
*
|
|
218
|
+
* Doubles on growth like the other physics scratches; never shrinks.
|
|
219
|
+
*
|
|
220
|
+
* @private
|
|
221
|
+
*/
|
|
222
|
+
private __reset_pseudo_velocity;
|
|
191
223
|
/**
|
|
192
224
|
* Replace the world gravity vector. Effective on the next step.
|
|
193
225
|
* @param {Vector3|{x:number,y:number,z:number}} v
|
|
@@ -444,6 +476,82 @@ export class PhysicsSystem extends System<any, any, any, any, any> {
|
|
|
444
476
|
* @returns {boolean}
|
|
445
477
|
*/
|
|
446
478
|
raycast(ray: Ray3, result: PhysicsSurfacePoint, filter?: (entity: number, collider: Collider) => boolean): boolean;
|
|
479
|
+
/**
|
|
480
|
+
* Sweep a convex shape along a ray and find the first body it
|
|
481
|
+
* would hit. The shape starts at `ray.origin` oriented by
|
|
482
|
+
* `rotation` and translates along `ray.direction` for up to
|
|
483
|
+
* `ray.tMax` units. Returns the nearest impact within that
|
|
484
|
+
* interval.
|
|
485
|
+
*
|
|
486
|
+
* The "swept AABB" broadphase finds candidate bodies whose BVH
|
|
487
|
+
* leaves overlap the shape's swept volume; the narrowphase then
|
|
488
|
+
* bisects [0, t] on GJK overlap to find the time-of-impact for
|
|
489
|
+
* each candidate. Best-t early termination skips candidates that
|
|
490
|
+
* can't tighten the answer.
|
|
491
|
+
*
|
|
492
|
+
* @param {Ray3} ray origin + unit direction + `tMax`
|
|
493
|
+
* @param {AbstractShape3D} shape
|
|
494
|
+
* @param {{x:number,y:number,z:number,w:number}} rotation
|
|
495
|
+
* @param {PhysicsSurfacePoint} result populated on hit; untouched on miss
|
|
496
|
+
* @param {(entity:number, collider:Collider)=>boolean} [filter]
|
|
497
|
+
* @returns {boolean}
|
|
498
|
+
*/
|
|
499
|
+
shapeCast(ray: Ray3, shape: AbstractShape3D, rotation: {
|
|
500
|
+
x: number;
|
|
501
|
+
y: number;
|
|
502
|
+
z: number;
|
|
503
|
+
w: number;
|
|
504
|
+
}, result: PhysicsSurfacePoint, filter?: (entity: number, collider: Collider) => boolean): boolean;
|
|
505
|
+
/**
|
|
506
|
+
* Speculative overlap query: find all bodies whose collider would
|
|
507
|
+
* overlap the given convex shape placed at the given world pose,
|
|
508
|
+
* without mutating the simulation. Intended for kinematic /
|
|
509
|
+
* character controllers that need to test "would I collide if I
|
|
510
|
+
* moved here?" before committing the move.
|
|
511
|
+
*
|
|
512
|
+
* Pipeline:
|
|
513
|
+
* 1. The shape's world AABB is computed from `position` + `rotation`.
|
|
514
|
+
* 2. Both broadphase trees (static + dynamic) are queried for
|
|
515
|
+
* bodies whose leaf AABB overlaps that envelope.
|
|
516
|
+
* 3. Each candidate is GJK-tested in world frame. Convex
|
|
517
|
+
* candidates run one GJK call; concave candidates (heightmap,
|
|
518
|
+
* mesh) run per-triangle GJK via the decomposition path.
|
|
519
|
+
* 4. The optional `filter` is consulted before the GJK test —
|
|
520
|
+
* useful for skipping the caller's own body, allies, sensors,
|
|
521
|
+
* etc.
|
|
522
|
+
*
|
|
523
|
+
* The output buffer is filled with overlapping bodies' `body_id`
|
|
524
|
+
* values (uint32 with packed generation), starting at
|
|
525
|
+
* `output_offset`. The caller is responsible for sizing the buffer;
|
|
526
|
+
* IDs past its end are dropped silently and the count caps at the
|
|
527
|
+
* available space.
|
|
528
|
+
*
|
|
529
|
+
* The query shape must be convex. Concave query shapes throw —
|
|
530
|
+
* they're typically static terrain and not used as kinematic
|
|
531
|
+
* probes; the M×N triangle-pair cost wouldn't be worth the rare
|
|
532
|
+
* use case.
|
|
533
|
+
*
|
|
534
|
+
* @param {AbstractShape3D} shape convex query shape, in its local frame
|
|
535
|
+
* @param {{x:number,y:number,z:number}} position world position of
|
|
536
|
+
* the query shape
|
|
537
|
+
* @param {{x:number,y:number,z:number,w:number}} rotation world
|
|
538
|
+
* rotation (unit quaternion)
|
|
539
|
+
* @param {Uint32Array|number[]} output buffer to receive body_ids
|
|
540
|
+
* @param {number} output_offset starting index in output
|
|
541
|
+
* @param {(entity:number, collider:Collider)=>boolean} [filter]
|
|
542
|
+
* defaults to {@link returnTrue}
|
|
543
|
+
* @returns {number} number of overlapping bodies written
|
|
544
|
+
*/
|
|
545
|
+
overlap(shape: AbstractShape3D, position: {
|
|
546
|
+
x: number;
|
|
547
|
+
y: number;
|
|
548
|
+
z: number;
|
|
549
|
+
}, rotation: {
|
|
550
|
+
x: number;
|
|
551
|
+
y: number;
|
|
552
|
+
z: number;
|
|
553
|
+
w: number;
|
|
554
|
+
}, output: Uint32Array | number[], output_offset: number, filter?: (entity: number, collider: Collider) => boolean): number;
|
|
447
555
|
/**
|
|
448
556
|
* Run one simulation step. v1 pipeline: integrate velocity → integrate
|
|
449
557
|
* position → refit broadphase AABBs. Narrowphase, solver, islands and
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PhysicsSystem.d.ts","sourceRoot":"","sources":["../../../../../src/engine/physics/ecs/PhysicsSystem.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"PhysicsSystem.d.ts","sourceRoot":"","sources":["../../../../../src/engine/physics/ecs/PhysicsSystem.js"],"names":[],"mappings":"AA4DA;;;;;;;;;;;;;;;;GAgBG;AACH;IAEI,cAqMC;IAlMG,sDAA0C;IAE1C,kKAIC;IAED;;OAEG;IACH,SAFU,WAAW,CAEW;IAEhC;;OAEG;IACH,WAFU,GAAG,CAEa;IAE1B;;OAEG;IACH,YAFU,GAAG,CAEc;IAE3B;;;OAGG;IACH,WAFU,aAAa,CAEa;IAEpC;;;;OAIG;IACH,OAFU,QAAQ,CAES;IAE3B;;;;OAIG;IACH,eAFU,kBAAkB,CAEiB;IAE7C;;;;;;;OAOG;IACH,SAFU,aAAa,CAEW;IAElC;;;;;;OAMG;IACH,2BAFU,MAAM,CAEqB;IAErC;;;;OAIG;IACH,oBAFU,MAAM,CAEa;IAE7B;;;;;;;;;;;OAWG;IACH,UAFU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