@woosh/meep-engine 2.139.0 → 2.141.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_multiply.d.ts +21 -0
- package/src/core/geom/3d/quaternion/quat3_multiply.d.ts.map +1 -0
- package/src/core/geom/3d/quaternion/quat3_multiply.js +25 -0
- 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 +578 -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/REVIEW_002.md +151 -0
- package/src/engine/physics/broadphase/compute_fat_world_aabb.js +2 -2
- package/src/engine/physics/constraint/DofMode.d.ts +28 -0
- package/src/engine/physics/constraint/DofMode.d.ts.map +1 -0
- package/src/engine/physics/constraint/DofMode.js +35 -0
- package/src/engine/physics/constraint/solve_constraints.d.ts +16 -0
- package/src/engine/physics/constraint/solve_constraints.d.ts.map +1 -0
- package/src/engine/physics/constraint/solve_constraints.js +436 -0
- 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/Joint.d.ts +179 -0
- package/src/engine/physics/ecs/Joint.d.ts.map +1 -0
- package/src/engine/physics/ecs/Joint.js +234 -0
- package/src/engine/physics/ecs/PhysicsSystem.d.ts +180 -20
- package/src/engine/physics/ecs/PhysicsSystem.d.ts.map +1 -1
- package/src/engine/physics/ecs/PhysicsSystem.js +1423 -1159
- package/src/engine/physics/fluid/FluidField.d.ts +14 -10
- package/src/engine/physics/fluid/FluidField.d.ts.map +1 -1
- package/src/engine/physics/fluid/FluidField.js +14 -10
- package/src/engine/physics/fluid/FluidSimulator.js +1 -1
- package/src/engine/physics/fluid/solver/v3_grid_compute_solid_neighbour_mask.d.ts +17 -10
- package/src/engine/physics/fluid/solver/v3_grid_compute_solid_neighbour_mask.d.ts.map +1 -1
- package/src/engine/physics/fluid/solver/v3_grid_compute_solid_neighbour_mask.js +18 -11
- package/src/engine/physics/fluid/solver/v3_grid_solve_pressure.d.ts +13 -10
- package/src/engine/physics/fluid/solver/v3_grid_solve_pressure.d.ts.map +1 -1
- package/src/engine/physics/fluid/solver/v3_grid_solve_pressure.js +18 -13
- package/src/engine/physics/fluid/solver/v3_grid_solve_pressure_pcg.d.ts +4 -3
- package/src/engine/physics/fluid/solver/v3_grid_solve_pressure_pcg.d.ts.map +1 -1
- package/src/engine/physics/fluid/solver/v3_grid_solve_pressure_pcg.js +15 -11
- package/src/engine/physics/fluid/solver/v3_grid_subtract_pressure_gradient.d.ts +30 -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 +44 -18
- 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/island/IslandBuilder.d.ts +4 -1
- package/src/engine/physics/island/IslandBuilder.d.ts.map +1 -1
- package/src/engine/physics/island/IslandBuilder.js +33 -16
- 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 +140 -18
- 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 +41 -2
- package/src/engine/physics/narrowphase/narrowphase_step.d.ts.map +1 -1
- package/src/engine/physics/narrowphase/narrowphase_step.js +1497 -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 +146 -32
- package/src/engine/physics/solver/solve_contacts.d.ts.map +1 -1
- package/src/engine/physics/solver/solve_contacts.js +809 -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"}
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Sentinel for {@link Joint#_jointId} before the joint is linked into a
|
|
3
|
+
* {@link PhysicsSystem}.
|
|
4
|
+
* @type {number}
|
|
5
|
+
*/
|
|
6
|
+
export const JOINT_UNALLOCATED: number;
|
|
7
|
+
/**
|
|
8
|
+
* `entityB` value meaning "the world" — body A is constrained to a fixed
|
|
9
|
+
* world anchor rather than to a second body.
|
|
10
|
+
* @type {number}
|
|
11
|
+
*/
|
|
12
|
+
export const JOINT_WORLD: number;
|
|
13
|
+
/**
|
|
14
|
+
* A configurable 6-DOF constraint between two bodies (or a body and the
|
|
15
|
+
* world). Connects body A's anchor frame to body B's; each of the 6 relative
|
|
16
|
+
* degrees of freedom (3 linear, 3 angular) is independently
|
|
17
|
+
* locked / free / limited / springy / motorised ({@link DofMode}). One
|
|
18
|
+
* constraint type expresses the whole joint taxonomy — see DofMode.
|
|
19
|
+
*
|
|
20
|
+
* The default configuration is a **ball-socket** (point-to-point): the three
|
|
21
|
+
* linear DOFs LOCKED (the two anchor points are held coincident), the three
|
|
22
|
+
* angular DOFs FREE. That alone gives chains, ropes, and pendulums.
|
|
23
|
+
*
|
|
24
|
+
* Anchors live in body-local frames. When `entityB === JOINT_WORLD`,
|
|
25
|
+
* `localAnchorB` is interpreted as a fixed **world** point instead of a
|
|
26
|
+
* local anchor on a second body.
|
|
27
|
+
*
|
|
28
|
+
* Solver state ({@link dofImpulse}, the `_*` fields) is owned by the
|
|
29
|
+
* PhysicsSystem; user code must not write it.
|
|
30
|
+
*
|
|
31
|
+
* @author Alex Goldring
|
|
32
|
+
* @copyright Company Named Limited (c) 2026
|
|
33
|
+
*/
|
|
34
|
+
export class Joint {
|
|
35
|
+
/**
|
|
36
|
+
* Entity owning body A (the constraint's first body — always a real body).
|
|
37
|
+
* @type {number}
|
|
38
|
+
*/
|
|
39
|
+
entityA: number;
|
|
40
|
+
/**
|
|
41
|
+
* Entity owning body B, or {@link JOINT_WORLD} to anchor A to the world.
|
|
42
|
+
* @type {number}
|
|
43
|
+
*/
|
|
44
|
+
entityB: number;
|
|
45
|
+
/**
|
|
46
|
+
* Anchor point on body A, in A's local frame.
|
|
47
|
+
* @readonly
|
|
48
|
+
* @type {Vector3}
|
|
49
|
+
*/
|
|
50
|
+
readonly localAnchorA: Vector3;
|
|
51
|
+
/**
|
|
52
|
+
* Anchor point on body B in B's local frame — or, when
|
|
53
|
+
* `entityB === JOINT_WORLD`, a fixed world-space anchor point.
|
|
54
|
+
* @readonly
|
|
55
|
+
* @type {Vector3}
|
|
56
|
+
*/
|
|
57
|
+
readonly localAnchorB: Vector3;
|
|
58
|
+
/**
|
|
59
|
+
* Orientation of the joint's reference frame on body A, in A's local
|
|
60
|
+
* space (a unit quaternion; identity = the joint frame is the body
|
|
61
|
+
* frame). The 3 linear and 3 angular DOFs are expressed in this frame:
|
|
62
|
+
* locked/limited/etc. axes are the frame's axes, not world axes. For a
|
|
63
|
+
* hinge, the free angular axis is one of these frame axes — orient the
|
|
64
|
+
* frame so that axis is the hinge axis.
|
|
65
|
+
* @readonly
|
|
66
|
+
* @type {Quaternion}
|
|
67
|
+
*/
|
|
68
|
+
readonly localBasisA: Quaternion;
|
|
69
|
+
/**
|
|
70
|
+
* Orientation of the joint's reference frame on body B, in B's local
|
|
71
|
+
* space. At rest a fully-locked joint holds frame B aligned to frame A.
|
|
72
|
+
* When `entityB === JOINT_WORLD`, the world frame is treated as identity
|
|
73
|
+
* (angular locks hold A's frame to world axes).
|
|
74
|
+
* @readonly
|
|
75
|
+
* @type {Quaternion}
|
|
76
|
+
*/
|
|
77
|
+
readonly localBasisB: Quaternion;
|
|
78
|
+
/**
|
|
79
|
+
* Per-DOF mode, 6 entries: `[lin x, lin y, lin z, ang x, ang y, ang z]`.
|
|
80
|
+
* Default = ball-socket (linear locked, angular free).
|
|
81
|
+
* @readonly
|
|
82
|
+
* @type {Uint8Array}
|
|
83
|
+
*/
|
|
84
|
+
readonly dofMode: Uint8Array;
|
|
85
|
+
/**
|
|
86
|
+
* Lower / upper bounds per DOF, used by {@link DofMode.LIMITED}. Linear in
|
|
87
|
+
* metres, angular in radians. (Reserved — consumed once the LIMITED mode
|
|
88
|
+
* lands.)
|
|
89
|
+
* @readonly
|
|
90
|
+
* @type {Float64Array}
|
|
91
|
+
*/
|
|
92
|
+
readonly dofLowerLimit: Float64Array;
|
|
93
|
+
/** @readonly @type {Float64Array} */
|
|
94
|
+
readonly dofUpperLimit: Float64Array;
|
|
95
|
+
/**
|
|
96
|
+
* Spring stiffness / damping per DOF, used by {@link DofMode.SPRING}.
|
|
97
|
+
* (Reserved — consumed once the SPRING mode lands.)
|
|
98
|
+
* @readonly
|
|
99
|
+
* @type {Float64Array}
|
|
100
|
+
*/
|
|
101
|
+
readonly dofStiffness: Float64Array;
|
|
102
|
+
/** @readonly @type {Float64Array} */
|
|
103
|
+
readonly dofDamping: Float64Array;
|
|
104
|
+
/**
|
|
105
|
+
* Motor target velocity / max force per DOF, used by
|
|
106
|
+
* {@link DofMode.MOTOR}. (Reserved — consumed once the MOTOR mode lands.)
|
|
107
|
+
* @readonly
|
|
108
|
+
* @type {Float64Array}
|
|
109
|
+
*/
|
|
110
|
+
readonly dofMotorTargetVelocity: Float64Array;
|
|
111
|
+
/** @readonly @type {Float64Array} */
|
|
112
|
+
readonly dofMotorMaxForce: Float64Array;
|
|
113
|
+
/**
|
|
114
|
+
* Accumulated constraint impulse per DOF — warm-start state carried across
|
|
115
|
+
* frames. System-owned.
|
|
116
|
+
* @readonly
|
|
117
|
+
* @type {Float64Array}
|
|
118
|
+
*/
|
|
119
|
+
readonly dofImpulse: Float64Array;
|
|
120
|
+
/**
|
|
121
|
+
* Resolved packed body id of A, set at link time. System-private.
|
|
122
|
+
* @type {number}
|
|
123
|
+
*/
|
|
124
|
+
_bodyIdA: number;
|
|
125
|
+
/**
|
|
126
|
+
* Resolved packed body id of B, or {@link JOINT_WORLD}. System-private.
|
|
127
|
+
* @type {number}
|
|
128
|
+
*/
|
|
129
|
+
_bodyIdB: number;
|
|
130
|
+
/**
|
|
131
|
+
* Packed joint handle assigned at link. System-private.
|
|
132
|
+
* @type {number}
|
|
133
|
+
*/
|
|
134
|
+
_jointId: number;
|
|
135
|
+
/**
|
|
136
|
+
* Configure this joint as a ball-socket (point-to-point) between two
|
|
137
|
+
* anchors. Linear DOFs locked, angular free — the default, provided as a
|
|
138
|
+
* named helper for clarity at call sites.
|
|
139
|
+
* @returns {Joint} this
|
|
140
|
+
*/
|
|
141
|
+
asBallSocket(): Joint;
|
|
142
|
+
/**
|
|
143
|
+
* Configure as a weld (fixed) joint: all 6 DOFs locked, holding the two
|
|
144
|
+
* bodies rigidly in their relative pose.
|
|
145
|
+
* @returns {Joint} this
|
|
146
|
+
*/
|
|
147
|
+
asWeld(): Joint;
|
|
148
|
+
/**
|
|
149
|
+
* Configure as a hinge (revolute): 3 linear + 2 angular locked, free to
|
|
150
|
+
* rotate about a single frame axis. Orient {@link localBasisA} /
|
|
151
|
+
* {@link localBasisB} so that frame axis is the desired hinge axis.
|
|
152
|
+
*
|
|
153
|
+
* @param {number} [freeAngularAxis] which frame axis is free: 0 = x
|
|
154
|
+
* (default), 1 = y, 2 = z.
|
|
155
|
+
* @returns {Joint} this
|
|
156
|
+
*/
|
|
157
|
+
asHinge(freeAngularAxis?: number): Joint;
|
|
158
|
+
/**
|
|
159
|
+
* Configure as a prismatic (slider): 2 linear + 3 angular locked, free to
|
|
160
|
+
* translate along a single frame axis. Orient {@link localBasisA} /
|
|
161
|
+
* {@link localBasisB} so that frame axis is the desired slide direction.
|
|
162
|
+
*
|
|
163
|
+
* @param {number} [freeLinearAxis] which frame axis is free: 0 = x
|
|
164
|
+
* (default), 1 = y, 2 = z.
|
|
165
|
+
* @returns {Joint} this
|
|
166
|
+
*/
|
|
167
|
+
asPrismatic(freeLinearAxis?: number): Joint;
|
|
168
|
+
/**
|
|
169
|
+
* @readonly
|
|
170
|
+
* @type {boolean}
|
|
171
|
+
*/
|
|
172
|
+
readonly isJoint: boolean;
|
|
173
|
+
}
|
|
174
|
+
export namespace Joint {
|
|
175
|
+
let typeName: string;
|
|
176
|
+
}
|
|
177
|
+
import Vector3 from "../../../core/geom/Vector3.js";
|
|
178
|
+
import Quaternion from "../../../core/geom/Quaternion.js";
|
|
179
|
+
//# sourceMappingURL=Joint.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Joint.d.ts","sourceRoot":"","sources":["../../../../../src/engine/physics/ecs/Joint.js"],"names":[],"mappings":"AAIA;;;;GAIG;AACH,gCAFU,MAAM,CAEoB;AAEpC;;;;GAIG;AACH,0BAFU,MAAM,CAEc;AAE9B;;;;;;;;;;;;;;;;;;;;GAoBG;AACH;IAEI;;;OAGG;IACH,SAFU,MAAM,CAEH;IAEb;;;OAGG;IACH,SAFU,MAAM,CAEM;IAEtB;;;;OAIG;IACH,uBAFU,OAAO,CAEmB;IAEpC;;;;;OAKG;IACH,uBAFU,OAAO,CAEmB;IAEpC;;;;;;;;;OASG;IACH,sBAFU,UAAU,CAEW;IAE/B;;;;;;;OAOG;IACH,sBAFU,UAAU,CAEW;IAE/B;;;;;OAKG;IACH,kBAFU,UAAU,CAKjB;IAEH;;;;;;OAMG;IACH,wBAFU,YAAY,CAEc;IACpC,qCAAqC;IACrC,wBADqB,YAAY,CACG;IAEpC;;;;;OAKG;IACH,uBAFU,YAAY,CAEa;IACnC,qCAAqC;IACrC,qBADqB,YAAY,CACA;IAEjC;;;;;OAKG;IACH,iCAFU,YAAY,CAEuB;IAC7C,qCAAqC;IACrC,2BADqB,YAAY,CACM;IAEvC;;;;;OAKG;IACH,qBAFU,YAAY,CAEW;IAEjC;;;OAGG;IACH,UAFU,MAAM,CAEF;IACd;;;OAGG;IACH,UAFU,MAAM,CAEO;IACvB;;;OAGG;IACH,UAFU,MAAM,CAEa;IAE7B;;;;;OAKG;IACH,gBAFa,KAAK,CAUjB;IAED;;;;OAIG;IACH,UAFa,KAAK,CAKjB;IAED;;;;;;;;OAQG;IACH,0BAJW,MAAM,GAEJ,KAAK,CAWjB;IAED;;;;;;;;OAQG;IACH,6BAJW,MAAM,GAEJ,KAAK,CAWjB;IASL;;;OAGG;IACH,kBAFU,OAAO,CAEM;CAZtB;;kBAIS,MAAM;;oBAjOI,+BAA+B;uBAC5B,kCAAkC"}
|
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
import Vector3 from "../../../core/geom/Vector3.js";
|
|
2
|
+
import Quaternion from "../../../core/geom/Quaternion.js";
|
|
3
|
+
import { DofMode } from "../constraint/DofMode.js";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Sentinel for {@link Joint#_jointId} before the joint is linked into a
|
|
7
|
+
* {@link PhysicsSystem}.
|
|
8
|
+
* @type {number}
|
|
9
|
+
*/
|
|
10
|
+
export const JOINT_UNALLOCATED = -1;
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* `entityB` value meaning "the world" — body A is constrained to a fixed
|
|
14
|
+
* world anchor rather than to a second body.
|
|
15
|
+
* @type {number}
|
|
16
|
+
*/
|
|
17
|
+
export const JOINT_WORLD = -1;
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* A configurable 6-DOF constraint between two bodies (or a body and the
|
|
21
|
+
* world). Connects body A's anchor frame to body B's; each of the 6 relative
|
|
22
|
+
* degrees of freedom (3 linear, 3 angular) is independently
|
|
23
|
+
* locked / free / limited / springy / motorised ({@link DofMode}). One
|
|
24
|
+
* constraint type expresses the whole joint taxonomy — see DofMode.
|
|
25
|
+
*
|
|
26
|
+
* The default configuration is a **ball-socket** (point-to-point): the three
|
|
27
|
+
* linear DOFs LOCKED (the two anchor points are held coincident), the three
|
|
28
|
+
* angular DOFs FREE. That alone gives chains, ropes, and pendulums.
|
|
29
|
+
*
|
|
30
|
+
* Anchors live in body-local frames. When `entityB === JOINT_WORLD`,
|
|
31
|
+
* `localAnchorB` is interpreted as a fixed **world** point instead of a
|
|
32
|
+
* local anchor on a second body.
|
|
33
|
+
*
|
|
34
|
+
* Solver state ({@link dofImpulse}, the `_*` fields) is owned by the
|
|
35
|
+
* PhysicsSystem; user code must not write it.
|
|
36
|
+
*
|
|
37
|
+
* @author Alex Goldring
|
|
38
|
+
* @copyright Company Named Limited (c) 2026
|
|
39
|
+
*/
|
|
40
|
+
export class Joint {
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Entity owning body A (the constraint's first body — always a real body).
|
|
44
|
+
* @type {number}
|
|
45
|
+
*/
|
|
46
|
+
entityA = -1;
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Entity owning body B, or {@link JOINT_WORLD} to anchor A to the world.
|
|
50
|
+
* @type {number}
|
|
51
|
+
*/
|
|
52
|
+
entityB = JOINT_WORLD;
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Anchor point on body A, in A's local frame.
|
|
56
|
+
* @readonly
|
|
57
|
+
* @type {Vector3}
|
|
58
|
+
*/
|
|
59
|
+
localAnchorA = new Vector3(0, 0, 0);
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Anchor point on body B in B's local frame — or, when
|
|
63
|
+
* `entityB === JOINT_WORLD`, a fixed world-space anchor point.
|
|
64
|
+
* @readonly
|
|
65
|
+
* @type {Vector3}
|
|
66
|
+
*/
|
|
67
|
+
localAnchorB = new Vector3(0, 0, 0);
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Orientation of the joint's reference frame on body A, in A's local
|
|
71
|
+
* space (a unit quaternion; identity = the joint frame is the body
|
|
72
|
+
* frame). The 3 linear and 3 angular DOFs are expressed in this frame:
|
|
73
|
+
* locked/limited/etc. axes are the frame's axes, not world axes. For a
|
|
74
|
+
* hinge, the free angular axis is one of these frame axes — orient the
|
|
75
|
+
* frame so that axis is the hinge axis.
|
|
76
|
+
* @readonly
|
|
77
|
+
* @type {Quaternion}
|
|
78
|
+
*/
|
|
79
|
+
localBasisA = new Quaternion();
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* Orientation of the joint's reference frame on body B, in B's local
|
|
83
|
+
* space. At rest a fully-locked joint holds frame B aligned to frame A.
|
|
84
|
+
* When `entityB === JOINT_WORLD`, the world frame is treated as identity
|
|
85
|
+
* (angular locks hold A's frame to world axes).
|
|
86
|
+
* @readonly
|
|
87
|
+
* @type {Quaternion}
|
|
88
|
+
*/
|
|
89
|
+
localBasisB = new Quaternion();
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Per-DOF mode, 6 entries: `[lin x, lin y, lin z, ang x, ang y, ang z]`.
|
|
93
|
+
* Default = ball-socket (linear locked, angular free).
|
|
94
|
+
* @readonly
|
|
95
|
+
* @type {Uint8Array}
|
|
96
|
+
*/
|
|
97
|
+
dofMode = Uint8Array.from([
|
|
98
|
+
DofMode.LOCKED, DofMode.LOCKED, DofMode.LOCKED,
|
|
99
|
+
DofMode.FREE, DofMode.FREE, DofMode.FREE,
|
|
100
|
+
]);
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Lower / upper bounds per DOF, used by {@link DofMode.LIMITED}. Linear in
|
|
104
|
+
* metres, angular in radians. (Reserved — consumed once the LIMITED mode
|
|
105
|
+
* lands.)
|
|
106
|
+
* @readonly
|
|
107
|
+
* @type {Float64Array}
|
|
108
|
+
*/
|
|
109
|
+
dofLowerLimit = new Float64Array(6);
|
|
110
|
+
/** @readonly @type {Float64Array} */
|
|
111
|
+
dofUpperLimit = new Float64Array(6);
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* Spring stiffness / damping per DOF, used by {@link DofMode.SPRING}.
|
|
115
|
+
* (Reserved — consumed once the SPRING mode lands.)
|
|
116
|
+
* @readonly
|
|
117
|
+
* @type {Float64Array}
|
|
118
|
+
*/
|
|
119
|
+
dofStiffness = new Float64Array(6);
|
|
120
|
+
/** @readonly @type {Float64Array} */
|
|
121
|
+
dofDamping = new Float64Array(6);
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* Motor target velocity / max force per DOF, used by
|
|
125
|
+
* {@link DofMode.MOTOR}. (Reserved — consumed once the MOTOR mode lands.)
|
|
126
|
+
* @readonly
|
|
127
|
+
* @type {Float64Array}
|
|
128
|
+
*/
|
|
129
|
+
dofMotorTargetVelocity = new Float64Array(6);
|
|
130
|
+
/** @readonly @type {Float64Array} */
|
|
131
|
+
dofMotorMaxForce = new Float64Array(6);
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* Accumulated constraint impulse per DOF — warm-start state carried across
|
|
135
|
+
* frames. System-owned.
|
|
136
|
+
* @readonly
|
|
137
|
+
* @type {Float64Array}
|
|
138
|
+
*/
|
|
139
|
+
dofImpulse = new Float64Array(6);
|
|
140
|
+
|
|
141
|
+
/**
|
|
142
|
+
* Resolved packed body id of A, set at link time. System-private.
|
|
143
|
+
* @type {number}
|
|
144
|
+
*/
|
|
145
|
+
_bodyIdA = -1;
|
|
146
|
+
/**
|
|
147
|
+
* Resolved packed body id of B, or {@link JOINT_WORLD}. System-private.
|
|
148
|
+
* @type {number}
|
|
149
|
+
*/
|
|
150
|
+
_bodyIdB = JOINT_WORLD;
|
|
151
|
+
/**
|
|
152
|
+
* Packed joint handle assigned at link. System-private.
|
|
153
|
+
* @type {number}
|
|
154
|
+
*/
|
|
155
|
+
_jointId = JOINT_UNALLOCATED;
|
|
156
|
+
|
|
157
|
+
/**
|
|
158
|
+
* Configure this joint as a ball-socket (point-to-point) between two
|
|
159
|
+
* anchors. Linear DOFs locked, angular free — the default, provided as a
|
|
160
|
+
* named helper for clarity at call sites.
|
|
161
|
+
* @returns {Joint} this
|
|
162
|
+
*/
|
|
163
|
+
asBallSocket() {
|
|
164
|
+
this.dofMode[0] = DofMode.LOCKED;
|
|
165
|
+
this.dofMode[1] = DofMode.LOCKED;
|
|
166
|
+
this.dofMode[2] = DofMode.LOCKED;
|
|
167
|
+
this.dofMode[3] = DofMode.FREE;
|
|
168
|
+
this.dofMode[4] = DofMode.FREE;
|
|
169
|
+
this.dofMode[5] = DofMode.FREE;
|
|
170
|
+
return this;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
/**
|
|
174
|
+
* Configure as a weld (fixed) joint: all 6 DOFs locked, holding the two
|
|
175
|
+
* bodies rigidly in their relative pose.
|
|
176
|
+
* @returns {Joint} this
|
|
177
|
+
*/
|
|
178
|
+
asWeld() {
|
|
179
|
+
for (let i = 0; i < 6; i++) this.dofMode[i] = DofMode.LOCKED;
|
|
180
|
+
return this;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
/**
|
|
184
|
+
* Configure as a hinge (revolute): 3 linear + 2 angular locked, free to
|
|
185
|
+
* rotate about a single frame axis. Orient {@link localBasisA} /
|
|
186
|
+
* {@link localBasisB} so that frame axis is the desired hinge axis.
|
|
187
|
+
*
|
|
188
|
+
* @param {number} [freeAngularAxis] which frame axis is free: 0 = x
|
|
189
|
+
* (default), 1 = y, 2 = z.
|
|
190
|
+
* @returns {Joint} this
|
|
191
|
+
*/
|
|
192
|
+
asHinge(freeAngularAxis = 0) {
|
|
193
|
+
this.dofMode[0] = DofMode.LOCKED;
|
|
194
|
+
this.dofMode[1] = DofMode.LOCKED;
|
|
195
|
+
this.dofMode[2] = DofMode.LOCKED;
|
|
196
|
+
this.dofMode[3] = DofMode.LOCKED;
|
|
197
|
+
this.dofMode[4] = DofMode.LOCKED;
|
|
198
|
+
this.dofMode[5] = DofMode.LOCKED;
|
|
199
|
+
this.dofMode[3 + freeAngularAxis] = DofMode.FREE;
|
|
200
|
+
return this;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
/**
|
|
204
|
+
* Configure as a prismatic (slider): 2 linear + 3 angular locked, free to
|
|
205
|
+
* translate along a single frame axis. Orient {@link localBasisA} /
|
|
206
|
+
* {@link localBasisB} so that frame axis is the desired slide direction.
|
|
207
|
+
*
|
|
208
|
+
* @param {number} [freeLinearAxis] which frame axis is free: 0 = x
|
|
209
|
+
* (default), 1 = y, 2 = z.
|
|
210
|
+
* @returns {Joint} this
|
|
211
|
+
*/
|
|
212
|
+
asPrismatic(freeLinearAxis = 0) {
|
|
213
|
+
this.dofMode[0] = DofMode.LOCKED;
|
|
214
|
+
this.dofMode[1] = DofMode.LOCKED;
|
|
215
|
+
this.dofMode[2] = DofMode.LOCKED;
|
|
216
|
+
this.dofMode[freeLinearAxis] = DofMode.FREE;
|
|
217
|
+
this.dofMode[3] = DofMode.LOCKED;
|
|
218
|
+
this.dofMode[4] = DofMode.LOCKED;
|
|
219
|
+
this.dofMode[5] = DofMode.LOCKED;
|
|
220
|
+
return this;
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
/**
|
|
225
|
+
* @readonly
|
|
226
|
+
* @type {string}
|
|
227
|
+
*/
|
|
228
|
+
Joint.typeName = "Joint";
|
|
229
|
+
|
|
230
|
+
/**
|
|
231
|
+
* @readonly
|
|
232
|
+
* @type {boolean}
|
|
233
|
+
*/
|
|
234
|
+
Joint.prototype.isJoint = true;
|