@codexo/exojs-physics 0.19.0 → 0.20.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/README.md +8 -73
- package/{dist/esm/debug/index.d.ts → debug.d.ts} +1 -2
- package/debug.js +1 -0
- package/index.d.ts +1 -0
- package/index.js +1 -0
- package/package.json +17 -23
- package/dist/esm/Aabb.d.ts +0 -10
- package/dist/esm/Aabb.d.ts.map +0 -1
- package/dist/esm/Aabb.js +0 -16
- package/dist/esm/Aabb.js.map +0 -1
- package/dist/esm/Collider.d.ts +0 -107
- package/dist/esm/Collider.d.ts.map +0 -1
- package/dist/esm/Collider.js +0 -284
- package/dist/esm/Collider.js.map +0 -1
- package/dist/esm/ContactGraph.d.ts +0 -154
- package/dist/esm/ContactGraph.d.ts.map +0 -1
- package/dist/esm/ContactGraph.js +0 -383
- package/dist/esm/ContactGraph.js.map +0 -1
- package/dist/esm/ContactModifier.d.ts +0 -62
- package/dist/esm/ContactModifier.d.ts.map +0 -1
- package/dist/esm/ContactModifier.js +0 -49
- package/dist/esm/ContactModifier.js.map +0 -1
- package/dist/esm/PhysicsBody.d.ts +0 -186
- package/dist/esm/PhysicsBody.d.ts.map +0 -1
- package/dist/esm/PhysicsBody.js +0 -526
- package/dist/esm/PhysicsBody.js.map +0 -1
- package/dist/esm/PhysicsBodyComponent.d.ts +0 -45
- package/dist/esm/PhysicsBodyComponent.d.ts.map +0 -1
- package/dist/esm/PhysicsBodyComponent.js +0 -77
- package/dist/esm/PhysicsBodyComponent.js.map +0 -1
- package/dist/esm/PhysicsWorld.d.ts +0 -567
- package/dist/esm/PhysicsWorld.d.ts.map +0 -1
- package/dist/esm/PhysicsWorld.js +0 -1096
- package/dist/esm/PhysicsWorld.js.map +0 -1
- package/dist/esm/TimeStepper.d.ts +0 -40
- package/dist/esm/TimeStepper.d.ts.map +0 -1
- package/dist/esm/TimeStepper.js +0 -59
- package/dist/esm/TimeStepper.js.map +0 -1
- package/dist/esm/backend/NativePhysicsBackend.d.ts +0 -28
- package/dist/esm/backend/NativePhysicsBackend.d.ts.map +0 -1
- package/dist/esm/backend/NativePhysicsBackend.js +0 -52
- package/dist/esm/backend/NativePhysicsBackend.js.map +0 -1
- package/dist/esm/backend/PhysicsBackend.d.ts +0 -38
- package/dist/esm/backend/PhysicsBackend.d.ts.map +0 -1
- package/dist/esm/binding/BindingRegistry.d.ts +0 -48
- package/dist/esm/binding/BindingRegistry.d.ts.map +0 -1
- package/dist/esm/binding/BindingRegistry.js +0 -81
- package/dist/esm/binding/BindingRegistry.js.map +0 -1
- package/dist/esm/binding/PhysicsBinding.d.ts +0 -37
- package/dist/esm/binding/PhysicsBinding.d.ts.map +0 -1
- package/dist/esm/binding/PhysicsBinding.js +0 -54
- package/dist/esm/binding/PhysicsBinding.js.map +0 -1
- package/dist/esm/binding/nodeWorldTransform.d.ts +0 -18
- package/dist/esm/binding/nodeWorldTransform.d.ts.map +0 -1
- package/dist/esm/binding/nodeWorldTransform.js +0 -41
- package/dist/esm/binding/nodeWorldTransform.js.map +0 -1
- package/dist/esm/broadphase/AabbTreeBroadPhase.d.ts +0 -84
- package/dist/esm/broadphase/AabbTreeBroadPhase.d.ts.map +0 -1
- package/dist/esm/broadphase/AabbTreeBroadPhase.js +0 -183
- package/dist/esm/broadphase/AabbTreeBroadPhase.js.map +0 -1
- package/dist/esm/broadphase/BroadPhase.d.ts +0 -25
- package/dist/esm/broadphase/BroadPhase.d.ts.map +0 -1
- package/dist/esm/broadphase/index.d.ts +0 -3
- package/dist/esm/broadphase/index.d.ts.map +0 -1
- package/dist/esm/collision/CollisionProxy.d.ts +0 -15
- package/dist/esm/collision/CollisionProxy.d.ts.map +0 -1
- package/dist/esm/collision/Manifold.d.ts +0 -34
- package/dist/esm/collision/Manifold.d.ts.map +0 -1
- package/dist/esm/collision/Manifold.js +0 -37
- package/dist/esm/collision/Manifold.js.map +0 -1
- package/dist/esm/collision/chainAdjacency.d.ts +0 -2
- package/dist/esm/collision/chainAdjacency.d.ts.map +0 -1
- package/dist/esm/collision/chainAdjacency.js +0 -44
- package/dist/esm/collision/chainAdjacency.js.map +0 -1
- package/dist/esm/collision/dispatch.d.ts +0 -35
- package/dist/esm/collision/dispatch.d.ts.map +0 -1
- package/dist/esm/collision/dispatch.js +0 -58
- package/dist/esm/collision/dispatch.js.map +0 -1
- package/dist/esm/collision/index.d.ts +0 -5
- package/dist/esm/collision/index.d.ts.map +0 -1
- package/dist/esm/collision/narrowphase.d.ts +0 -17
- package/dist/esm/collision/narrowphase.d.ts.map +0 -1
- package/dist/esm/collision/narrowphase.js +0 -555
- package/dist/esm/collision/narrowphase.js.map +0 -1
- package/dist/esm/collision/segments.d.ts +0 -19
- package/dist/esm/collision/segments.d.ts.map +0 -1
- package/dist/esm/collision/segments.js +0 -36
- package/dist/esm/collision/segments.js.map +0 -1
- package/dist/esm/collision/sweep.d.ts +0 -35
- package/dist/esm/collision/sweep.d.ts.map +0 -1
- package/dist/esm/collision/sweep.js +0 -437
- package/dist/esm/collision/sweep.js.map +0 -1
- package/dist/esm/debug/PhysicsDebugDraw.d.ts +0 -72
- package/dist/esm/debug/PhysicsDebugDraw.d.ts.map +0 -1
- package/dist/esm/debug/PhysicsDebugDraw.js +0 -239
- package/dist/esm/debug/PhysicsDebugDraw.js.map +0 -1
- package/dist/esm/debug/index.d.ts.map +0 -1
- package/dist/esm/debug/index.js +0 -3
- package/dist/esm/events.d.ts +0 -36
- package/dist/esm/events.d.ts.map +0 -1
- package/dist/esm/index.d.ts +0 -2
- package/dist/esm/index.d.ts.map +0 -1
- package/dist/esm/index.js +0 -25
- package/dist/esm/joints/DistanceJoint.d.ts +0 -70
- package/dist/esm/joints/DistanceJoint.d.ts.map +0 -1
- package/dist/esm/joints/DistanceJoint.js +0 -167
- package/dist/esm/joints/DistanceJoint.js.map +0 -1
- package/dist/esm/joints/Joint.d.ts +0 -76
- package/dist/esm/joints/Joint.d.ts.map +0 -1
- package/dist/esm/joints/Joint.js +0 -62
- package/dist/esm/joints/Joint.js.map +0 -1
- package/dist/esm/joints/MouseJoint.d.ts +0 -55
- package/dist/esm/joints/MouseJoint.d.ts.map +0 -1
- package/dist/esm/joints/MouseJoint.js +0 -139
- package/dist/esm/joints/MouseJoint.js.map +0 -1
- package/dist/esm/joints/PrismaticJoint.d.ts +0 -84
- package/dist/esm/joints/PrismaticJoint.d.ts.map +0 -1
- package/dist/esm/joints/PrismaticJoint.js +0 -218
- package/dist/esm/joints/PrismaticJoint.js.map +0 -1
- package/dist/esm/joints/RevoluteJoint.d.ts +0 -77
- package/dist/esm/joints/RevoluteJoint.d.ts.map +0 -1
- package/dist/esm/joints/RevoluteJoint.js +0 -204
- package/dist/esm/joints/RevoluteJoint.js.map +0 -1
- package/dist/esm/joints/WeldJoint.d.ts +0 -60
- package/dist/esm/joints/WeldJoint.d.ts.map +0 -1
- package/dist/esm/joints/WeldJoint.js +0 -166
- package/dist/esm/joints/WeldJoint.js.map +0 -1
- package/dist/esm/joints/WheelJoint.d.ts +0 -91
- package/dist/esm/joints/WheelJoint.d.ts.map +0 -1
- package/dist/esm/joints/WheelJoint.js +0 -235
- package/dist/esm/joints/WheelJoint.js.map +0 -1
- package/dist/esm/math.d.ts +0 -29
- package/dist/esm/math.d.ts.map +0 -1
- package/dist/esm/math.js +0 -60
- package/dist/esm/math.js.map +0 -1
- package/dist/esm/physicsBuildInfo.d.ts +0 -16
- package/dist/esm/physicsBuildInfo.d.ts.map +0 -1
- package/dist/esm/physicsBuildInfo.js +0 -10
- package/dist/esm/physicsBuildInfo.js.map +0 -1
- package/dist/esm/public.d.ts +0 -34
- package/dist/esm/public.d.ts.map +0 -1
- package/dist/esm/query/QueryEngine.d.ts +0 -95
- package/dist/esm/query/QueryEngine.d.ts.map +0 -1
- package/dist/esm/query/QueryEngine.js +0 -512
- package/dist/esm/query/QueryEngine.js.map +0 -1
- package/dist/esm/query/SpatialIndex.d.ts +0 -34
- package/dist/esm/query/SpatialIndex.d.ts.map +0 -1
- package/dist/esm/shapes/AnyShape.d.ts +0 -14
- package/dist/esm/shapes/AnyShape.d.ts.map +0 -1
- package/dist/esm/shapes/BoxShape.d.ts +0 -12
- package/dist/esm/shapes/BoxShape.d.ts.map +0 -1
- package/dist/esm/shapes/BoxShape.js +0 -41
- package/dist/esm/shapes/BoxShape.js.map +0 -1
- package/dist/esm/shapes/CapsuleShape.d.ts +0 -30
- package/dist/esm/shapes/CapsuleShape.d.ts.map +0 -1
- package/dist/esm/shapes/CapsuleShape.js +0 -88
- package/dist/esm/shapes/CapsuleShape.js.map +0 -1
- package/dist/esm/shapes/ChainEdgeShape.d.ts +0 -2
- package/dist/esm/shapes/ChainEdgeShape.d.ts.map +0 -1
- package/dist/esm/shapes/ChainEdgeShape.js +0 -66
- package/dist/esm/shapes/ChainEdgeShape.js.map +0 -1
- package/dist/esm/shapes/ChainShape.d.ts +0 -46
- package/dist/esm/shapes/ChainShape.d.ts.map +0 -1
- package/dist/esm/shapes/ChainShape.js +0 -85
- package/dist/esm/shapes/ChainShape.js.map +0 -1
- package/dist/esm/shapes/CircleShape.d.ts +0 -14
- package/dist/esm/shapes/CircleShape.d.ts.map +0 -1
- package/dist/esm/shapes/CircleShape.js +0 -31
- package/dist/esm/shapes/CircleShape.js.map +0 -1
- package/dist/esm/shapes/PolygonShape.d.ts +0 -24
- package/dist/esm/shapes/PolygonShape.d.ts.map +0 -1
- package/dist/esm/shapes/PolygonShape.js +0 -153
- package/dist/esm/shapes/PolygonShape.js.map +0 -1
- package/dist/esm/shapes/SegmentShape.d.ts +0 -31
- package/dist/esm/shapes/SegmentShape.d.ts.map +0 -1
- package/dist/esm/shapes/SegmentShape.js +0 -62
- package/dist/esm/shapes/SegmentShape.js.map +0 -1
- package/dist/esm/shapes/Shape.d.ts +0 -37
- package/dist/esm/shapes/Shape.d.ts.map +0 -1
- package/dist/esm/shapes/Shape.js +0 -15
- package/dist/esm/shapes/Shape.js.map +0 -1
- package/dist/esm/shapes/convexParts.d.ts +0 -21
- package/dist/esm/shapes/convexParts.d.ts.map +0 -1
- package/dist/esm/shapes/convexParts.js +0 -26
- package/dist/esm/shapes/convexParts.js.map +0 -1
- package/dist/esm/shapes/decompose.d.ts +0 -2
- package/dist/esm/shapes/decompose.d.ts.map +0 -1
- package/dist/esm/shapes/decompose.js +0 -272
- package/dist/esm/shapes/decompose.js.map +0 -1
- package/dist/esm/shapes/index.d.ts +0 -9
- package/dist/esm/shapes/index.d.ts.map +0 -1
- package/dist/esm/solver/ContactSolver.d.ts +0 -94
- package/dist/esm/solver/ContactSolver.d.ts.map +0 -1
- package/dist/esm/solver/ContactSolver.js +0 -457
- package/dist/esm/solver/ContactSolver.js.map +0 -1
- package/dist/esm/solver/tolerances.d.ts +0 -2
- package/dist/esm/solver/tolerances.d.ts.map +0 -1
- package/dist/esm/solver/tolerances.js +0 -36
- package/dist/esm/solver/tolerances.js.map +0 -1
- package/dist/esm/sort.d.ts +0 -2
- package/dist/esm/sort.d.ts.map +0 -1
- package/dist/esm/sort.js +0 -44
- package/dist/esm/sort.js.map +0 -1
- package/dist/esm/types.d.ts +0 -35
- package/dist/esm/types.d.ts.map +0 -1
- package/dist/esm/types.js +0 -26
- package/dist/esm/types.js.map +0 -1
|
@@ -1,239 +0,0 @@
|
|
|
1
|
-
import { aabbOverlap } from "../Aabb.js";
|
|
2
|
-
import { authoredCollider } from "../Collider.js";
|
|
3
|
-
import { Manifold } from "../collision/Manifold.js";
|
|
4
|
-
import { collide } from "../collision/narrowphase.js";
|
|
5
|
-
import { Color, Graphics } from "@codexo/exojs";
|
|
6
|
-
import { DebugLayer } from "@codexo/exojs/debug";
|
|
7
|
-
|
|
8
|
-
//#region src/debug/PhysicsDebugDraw.ts
|
|
9
|
-
const segments = 24;
|
|
10
|
-
/** `Color` channels are bytes, so a colour written as unit-range fractions has to be scaled to them. */
|
|
11
|
-
const unitColor = (r, g, b, a) => new Color(Math.round(r * 255), Math.round(g * 255), Math.round(b * 255), a);
|
|
12
|
-
const colorStatic = unitColor(.3, .9, .4, .9);
|
|
13
|
-
const colorKinematic = unitColor(.4, .7, 1, .9);
|
|
14
|
-
const colorDynamic = unitColor(1, .85, .3, .9);
|
|
15
|
-
const colorSensor = unitColor(1, .3, 1, .9);
|
|
16
|
-
const colorAabb = unitColor(.5, .5, .5, .5);
|
|
17
|
-
const colorContact = unitColor(1, .2, .2, 1);
|
|
18
|
-
const colorNormal = unitColor(1, .6, .1, 1);
|
|
19
|
-
const colorCenter = unitColor(1, 1, 1, .9);
|
|
20
|
-
const colorBroadphase = unitColor(.2, .8, .8, .5);
|
|
21
|
-
const colorSleeping = unitColor(.45, .45, .5, .7);
|
|
22
|
-
const colorJoint = unitColor(.9, .5, 1, .8);
|
|
23
|
-
/**
|
|
24
|
-
* `DebugLayer` that visualises a {@link PhysicsWorld} - shapes, AABBs, contacts,
|
|
25
|
-
* normals, centres and broad-phase links. It reads the world's public state and
|
|
26
|
-
* recomputes contacts/broad-phase locally only while visible, so it never
|
|
27
|
-
* perturbs the simulation and works over any backend. Lives in the `./debug`
|
|
28
|
-
* subpath so it tree-shakes out of production bundles.
|
|
29
|
-
*/
|
|
30
|
-
var PhysicsDebugDraw = class extends DebugLayer {
|
|
31
|
-
/** Mutable option flags (read each frame). */
|
|
32
|
-
options;
|
|
33
|
-
_world;
|
|
34
|
-
_graphics = null;
|
|
35
|
-
_manifold = new Manifold();
|
|
36
|
-
_pairs = [];
|
|
37
|
-
constructor(app, world, options = {}) {
|
|
38
|
-
super(app);
|
|
39
|
-
this._world = world;
|
|
40
|
-
this.options = {
|
|
41
|
-
drawShapes: options.drawShapes ?? true,
|
|
42
|
-
drawAabb: options.drawAabb ?? false,
|
|
43
|
-
drawContacts: options.drawContacts ?? false,
|
|
44
|
-
drawNormals: options.drawNormals ?? false,
|
|
45
|
-
drawCenters: options.drawCenters ?? false,
|
|
46
|
-
drawBroadphase: options.drawBroadphase ?? false,
|
|
47
|
-
drawSleeping: options.drawSleeping ?? false,
|
|
48
|
-
drawJoints: options.drawJoints ?? false
|
|
49
|
-
};
|
|
50
|
-
}
|
|
51
|
-
get viewMode() {
|
|
52
|
-
return "world";
|
|
53
|
-
}
|
|
54
|
-
update() {}
|
|
55
|
-
render(backend) {
|
|
56
|
-
const gfx = this._graphics ??= new Graphics();
|
|
57
|
-
const options = this.options;
|
|
58
|
-
gfx.clear();
|
|
59
|
-
gfx.lineWidth = 1;
|
|
60
|
-
if (options.drawBroadphase) this._renderBroadphase(gfx);
|
|
61
|
-
if (options.drawAabb) for (const collider of this._world.detectionGeometry) this._strokeAabb(gfx, collider);
|
|
62
|
-
if (options.drawShapes) for (const collider of this._world.colliders) this._strokeShape(gfx, collider);
|
|
63
|
-
if (options.drawCenters) {
|
|
64
|
-
gfx.lineColor = colorCenter;
|
|
65
|
-
for (const body of this._world.bodies) this._strokeCross(gfx, body.x, body.y, 4);
|
|
66
|
-
}
|
|
67
|
-
if (options.drawContacts || options.drawNormals) this._renderContacts(gfx);
|
|
68
|
-
if (options.drawJoints) this._renderJoints(gfx);
|
|
69
|
-
gfx.render(backend);
|
|
70
|
-
}
|
|
71
|
-
_renderJoints(gfx) {
|
|
72
|
-
gfx.lineColor = colorJoint;
|
|
73
|
-
for (const joint of this._world.joints) {
|
|
74
|
-
gfx.moveTo(joint.bodyA.x, joint.bodyA.y);
|
|
75
|
-
gfx.lineTo(joint.bodyB.x, joint.bodyB.y);
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
destroy() {
|
|
79
|
-
if (this._graphics !== null) {
|
|
80
|
-
this._graphics.destroy();
|
|
81
|
-
this._graphics = null;
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
_outlineColor(collider) {
|
|
85
|
-
if (collider.isSensor) return colorSensor;
|
|
86
|
-
if (this.options.drawSleeping && collider.body.isSleeping) return colorSleeping;
|
|
87
|
-
return colorForType(collider.body.type);
|
|
88
|
-
}
|
|
89
|
-
_strokeShape(gfx, collider) {
|
|
90
|
-
gfx.lineColor = this._outlineColor(collider);
|
|
91
|
-
if (collider.shape.type === "circle") {
|
|
92
|
-
const c = collider.worldCenter;
|
|
93
|
-
const r = collider.shape.radius;
|
|
94
|
-
this._strokeCircle(gfx, c.x, c.y, r);
|
|
95
|
-
gfx.moveTo(c.x, c.y);
|
|
96
|
-
gfx.lineTo(c.x + collider.worldTransform.cos * r, c.y + collider.worldTransform.sin * r);
|
|
97
|
-
return;
|
|
98
|
-
}
|
|
99
|
-
if (collider.shape.type === "capsule") {
|
|
100
|
-
this._strokeCapsule(gfx, collider.worldVertices, collider.shape.radius);
|
|
101
|
-
return;
|
|
102
|
-
}
|
|
103
|
-
if (collider.shape.type === "segment") {
|
|
104
|
-
const ends = collider.worldVertices;
|
|
105
|
-
gfx.moveTo(ends[0], ends[1]);
|
|
106
|
-
gfx.lineTo(ends[2], ends[3]);
|
|
107
|
-
return;
|
|
108
|
-
}
|
|
109
|
-
if (collider.shape.type === "chain") {
|
|
110
|
-
for (const edge of collider.chainEdges ?? []) {
|
|
111
|
-
const ends = edge.worldVertices;
|
|
112
|
-
gfx.moveTo(ends[0], ends[1]);
|
|
113
|
-
gfx.lineTo(ends[2], ends[3]);
|
|
114
|
-
}
|
|
115
|
-
return;
|
|
116
|
-
}
|
|
117
|
-
const verts = collider.worldVertices;
|
|
118
|
-
const count = collider.shape.count;
|
|
119
|
-
gfx.moveTo(verts[0], verts[1]);
|
|
120
|
-
for (let i = 1; i <= count; i++) {
|
|
121
|
-
const j = i % count;
|
|
122
|
-
gfx.lineTo(verts[j * 2], verts[j * 2 + 1]);
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
/**
|
|
126
|
-
* Capsule outline: the two straight sides offset from the spine, joined by a
|
|
127
|
-
* half-circle at each end. The arcs are approximated - a visualisation may
|
|
128
|
-
* tessellate, the solver never does.
|
|
129
|
-
*/
|
|
130
|
-
_strokeCapsule(gfx, spine, radius) {
|
|
131
|
-
const ax = spine[0];
|
|
132
|
-
const ay = spine[1];
|
|
133
|
-
const bx = spine[2];
|
|
134
|
-
const by = spine[3];
|
|
135
|
-
const along = Math.atan2(by - ay, bx - ax);
|
|
136
|
-
const arcSegments = 12;
|
|
137
|
-
gfx.moveTo(ax + Math.cos(along + Math.PI / 2) * radius, ay + Math.sin(along + Math.PI / 2) * radius);
|
|
138
|
-
gfx.lineTo(bx + Math.cos(along + Math.PI / 2) * radius, by + Math.sin(along + Math.PI / 2) * radius);
|
|
139
|
-
for (let i = 1; i <= arcSegments; i++) {
|
|
140
|
-
const angle = along + Math.PI / 2 - Math.PI * i / arcSegments;
|
|
141
|
-
gfx.lineTo(bx + Math.cos(angle) * radius, by + Math.sin(angle) * radius);
|
|
142
|
-
}
|
|
143
|
-
for (let i = 1; i <= arcSegments; i++) {
|
|
144
|
-
const angle = along - Math.PI / 2 - Math.PI * i / arcSegments;
|
|
145
|
-
gfx.lineTo(ax + Math.cos(angle) * radius, ay + Math.sin(angle) * radius);
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
_strokeAabb(gfx, collider) {
|
|
149
|
-
const box = collider.aabb;
|
|
150
|
-
gfx.lineColor = colorAabb;
|
|
151
|
-
gfx.moveTo(box.minX, box.minY);
|
|
152
|
-
gfx.lineTo(box.maxX, box.minY);
|
|
153
|
-
gfx.lineTo(box.maxX, box.maxY);
|
|
154
|
-
gfx.lineTo(box.minX, box.maxY);
|
|
155
|
-
gfx.lineTo(box.minX, box.minY);
|
|
156
|
-
}
|
|
157
|
-
_strokeCircle(gfx, cx, cy, r) {
|
|
158
|
-
gfx.moveTo(cx + r, cy);
|
|
159
|
-
for (let i = 1; i <= segments; i++) {
|
|
160
|
-
const a = i / segments * Math.PI * 2;
|
|
161
|
-
gfx.lineTo(cx + Math.cos(a) * r, cy + Math.sin(a) * r);
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
_strokeCross(gfx, x, y, size) {
|
|
165
|
-
gfx.moveTo(x - size, y);
|
|
166
|
-
gfx.lineTo(x + size, y);
|
|
167
|
-
gfx.moveTo(x, y - size);
|
|
168
|
-
gfx.lineTo(x, y + size);
|
|
169
|
-
}
|
|
170
|
-
/**
|
|
171
|
-
* Recomputes candidate pairs from scratch for the current frame via a plain
|
|
172
|
-
* brute-force AABB-overlap scan - deliberately NOT `AabbTreeBroadPhase`.
|
|
173
|
-
* That class relies on `Collider._treeProxy`, a field shared on the
|
|
174
|
-
* Collider object and valid only for whichever ONE broad phase currently
|
|
175
|
-
* owns it (the world's own `NativePhysicsBackend`); a second instance here
|
|
176
|
-
* would silently corrupt that ownership every time debug draw and a
|
|
177
|
-
* physics step interleave. Debug-only/opt-in (tree-shaken from production
|
|
178
|
-
* bundles), recomputed from scratch every visible frame regardless, so an
|
|
179
|
-
* O(n^2) scan is an appropriate, fully self-contained trade for
|
|
180
|
-
* correctness - it touches no state outside this method.
|
|
181
|
-
*/
|
|
182
|
-
_collectPairs() {
|
|
183
|
-
const colliders = this._world.detectionGeometry;
|
|
184
|
-
const pairs = this._pairs;
|
|
185
|
-
pairs.length = 0;
|
|
186
|
-
for (let i = 0; i < colliders.length; i++) {
|
|
187
|
-
const a = colliders[i];
|
|
188
|
-
for (let j = i + 1; j < colliders.length; j++) {
|
|
189
|
-
const b = colliders[j];
|
|
190
|
-
if (a.body !== b.body && aabbOverlap(a.aabb, b.aabb)) pairs.push(a.id < b.id ? {
|
|
191
|
-
a,
|
|
192
|
-
b
|
|
193
|
-
} : {
|
|
194
|
-
a: b,
|
|
195
|
-
b: a
|
|
196
|
-
});
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
}
|
|
200
|
-
_renderBroadphase(gfx) {
|
|
201
|
-
this._collectPairs();
|
|
202
|
-
gfx.lineColor = colorBroadphase;
|
|
203
|
-
for (const pair of this._pairs) {
|
|
204
|
-
const a = pair.a.aabb;
|
|
205
|
-
const b = pair.b.aabb;
|
|
206
|
-
gfx.moveTo((a.minX + a.maxX) * .5, (a.minY + a.maxY) * .5);
|
|
207
|
-
gfx.lineTo((b.minX + b.maxX) * .5, (b.minY + b.maxY) * .5);
|
|
208
|
-
}
|
|
209
|
-
}
|
|
210
|
-
_renderContacts(gfx) {
|
|
211
|
-
this._collectPairs();
|
|
212
|
-
for (const pair of this._pairs) {
|
|
213
|
-
const a = pair.a;
|
|
214
|
-
const b = pair.b;
|
|
215
|
-
if (authoredCollider(a).isSensor || authoredCollider(b).isSensor) continue;
|
|
216
|
-
if (!collide(a, b, this._manifold)) continue;
|
|
217
|
-
for (let i = 0; i < this._manifold.pointCount; i++) {
|
|
218
|
-
const point = i === 0 ? this._manifold.points[0] : this._manifold.points[1];
|
|
219
|
-
if (this.options.drawContacts) {
|
|
220
|
-
gfx.lineColor = colorContact;
|
|
221
|
-
this._strokeCross(gfx, point.x, point.y, 3);
|
|
222
|
-
}
|
|
223
|
-
if (this.options.drawNormals) {
|
|
224
|
-
gfx.lineColor = colorNormal;
|
|
225
|
-
gfx.moveTo(point.x, point.y);
|
|
226
|
-
gfx.lineTo(point.x + this._manifold.normalX * 12, point.y + this._manifold.normalY * 12);
|
|
227
|
-
}
|
|
228
|
-
}
|
|
229
|
-
}
|
|
230
|
-
}
|
|
231
|
-
};
|
|
232
|
-
const colorForType = (type) => {
|
|
233
|
-
if (type === "static") return colorStatic;
|
|
234
|
-
return type === "kinematic" ? colorKinematic : colorDynamic;
|
|
235
|
-
};
|
|
236
|
-
|
|
237
|
-
//#endregion
|
|
238
|
-
export { PhysicsDebugDraw };
|
|
239
|
-
//# sourceMappingURL=PhysicsDebugDraw.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"PhysicsDebugDraw.js","names":[],"sources":["../../../src/debug/PhysicsDebugDraw.ts"],"sourcesContent":["import type { Application } from '@codexo/exojs';\nimport { Color, Graphics } from '@codexo/exojs';\nimport type { DebugLayerViewMode } from '@codexo/exojs/debug';\nimport { DebugLayer } from '@codexo/exojs/debug';\nimport type { RenderBackend } from '@codexo/exojs/renderer-sdk';\n\nimport { aabbOverlap } from '../Aabb';\nimport type { CandidatePair } from '../broadphase/BroadPhase';\nimport type { Collider } from '../Collider';\nimport { authoredCollider } from '../Collider';\nimport { Manifold } from '../collision/Manifold';\nimport { collide } from '../collision/narrowphase';\nimport type { PhysicsWorld } from '../PhysicsWorld';\nimport type { BodyType } from '../types';\n\n/** Toggles for the physics debug overlay. */\nexport interface PhysicsDebugDrawOptions {\n /** Collider shape outlines, coloured by body type. Default `true`. */\n drawShapes?: boolean;\n /** World AABBs of the geometry the broad phase holds - a chain as its per-edge leaves. Default `false`. */\n drawAabb?: boolean;\n /** Contact points. Default `false`. */\n drawContacts?: boolean;\n /** Contact normals. Default `false`. */\n drawNormals?: boolean;\n /** Body origins (centre markers). Default `false`. */\n drawCenters?: boolean;\n /** Broad-phase candidate links between AABB-overlapping leaves - a chain links per edge. Default `false`. */\n drawBroadphase?: boolean;\n /** Tint sleeping bodies distinctly (applies to the shape outline). Default `false`. */\n drawSleeping?: boolean;\n /** Lines connecting the bodies of each joint. Default `false`. */\n drawJoints?: boolean;\n}\n\nconst segments = 24;\n\n/** `Color` channels are bytes, so a colour written as unit-range fractions has to be scaled to them. */\nconst unitColor = (r: number, g: number, b: number, a: number): Color => new Color(Math.round(r * 255), Math.round(g * 255), Math.round(b * 255), a);\n\nconst colorStatic = unitColor(0.3, 0.9, 0.4, 0.9);\nconst colorKinematic = unitColor(0.4, 0.7, 1, 0.9);\nconst colorDynamic = unitColor(1, 0.85, 0.3, 0.9);\nconst colorSensor = unitColor(1, 0.3, 1, 0.9);\nconst colorAabb = unitColor(0.5, 0.5, 0.5, 0.5);\nconst colorContact = unitColor(1, 0.2, 0.2, 1);\nconst colorNormal = unitColor(1, 0.6, 0.1, 1);\nconst colorCenter = unitColor(1, 1, 1, 0.9);\nconst colorBroadphase = unitColor(0.2, 0.8, 0.8, 0.5);\nconst colorSleeping = unitColor(0.45, 0.45, 0.5, 0.7);\nconst colorJoint = unitColor(0.9, 0.5, 1, 0.8);\n\n/**\n * `DebugLayer` that visualises a {@link PhysicsWorld} - shapes, AABBs, contacts,\n * normals, centres and broad-phase links. It reads the world's public state and\n * recomputes contacts/broad-phase locally only while visible, so it never\n * perturbs the simulation and works over any backend. Lives in the `./debug`\n * subpath so it tree-shakes out of production bundles.\n */\nexport class PhysicsDebugDraw extends DebugLayer {\n /** Mutable option flags (read each frame). */\n public readonly options: Required<PhysicsDebugDrawOptions>;\n\n private readonly _world: PhysicsWorld;\n private _graphics: Graphics | null = null;\n private readonly _manifold = new Manifold();\n private readonly _pairs: CandidatePair[] = [];\n\n public constructor(app: Application, world: PhysicsWorld, options: PhysicsDebugDrawOptions = {}) {\n super(app);\n\n this._world = world;\n this.options = {\n drawShapes: options.drawShapes ?? true,\n drawAabb: options.drawAabb ?? false,\n drawContacts: options.drawContacts ?? false,\n drawNormals: options.drawNormals ?? false,\n drawCenters: options.drawCenters ?? false,\n drawBroadphase: options.drawBroadphase ?? false,\n drawSleeping: options.drawSleeping ?? false,\n drawJoints: options.drawJoints ?? false,\n };\n }\n\n public override get viewMode(): DebugLayerViewMode {\n return 'world';\n }\n\n public override update(): void {\n // All state is read from the world in render().\n }\n\n public override render(backend: RenderBackend): void {\n const gfx = (this._graphics ??= new Graphics());\n const options = this.options;\n\n gfx.clear();\n gfx.lineWidth = 1;\n\n if (options.drawBroadphase) {\n this._renderBroadphase(gfx);\n }\n\n if (options.drawAabb) {\n // The solver-side geometry, so a chain shows the leaves the broad phase\n // actually holds rather than the union box no phase ever tests.\n for (const collider of this._world.detectionGeometry) {\n this._strokeAabb(gfx, collider);\n }\n }\n\n if (options.drawShapes) {\n for (const collider of this._world.colliders) {\n this._strokeShape(gfx, collider);\n }\n }\n\n if (options.drawCenters) {\n gfx.lineColor = colorCenter;\n\n for (const body of this._world.bodies) {\n this._strokeCross(gfx, body.x, body.y, 4);\n }\n }\n\n if (options.drawContacts || options.drawNormals) {\n this._renderContacts(gfx);\n }\n\n if (options.drawJoints) {\n this._renderJoints(gfx);\n }\n\n gfx.render(backend);\n }\n\n private _renderJoints(gfx: Graphics): void {\n gfx.lineColor = colorJoint;\n\n for (const joint of this._world.joints) {\n gfx.moveTo(joint.bodyA.x, joint.bodyA.y);\n gfx.lineTo(joint.bodyB.x, joint.bodyB.y);\n }\n }\n\n public override destroy(): void {\n if (this._graphics !== null) {\n this._graphics.destroy();\n this._graphics = null;\n }\n }\n\n // ── helpers ────────────────────────────────────────────────────────────\n\n private _outlineColor(collider: Collider): Color {\n if (collider.isSensor) {\n return colorSensor;\n }\n\n if (this.options.drawSleeping && collider.body.isSleeping) {\n return colorSleeping;\n }\n\n return colorForType(collider.body.type);\n }\n\n private _strokeShape(gfx: Graphics, collider: Collider): void {\n gfx.lineColor = this._outlineColor(collider);\n\n if (collider.shape.type === 'circle') {\n const c = collider.worldCenter;\n const r = collider.shape.radius;\n\n this._strokeCircle(gfx, c.x, c.y, r);\n // A spoke to the surface conveys orientation once bodies rotate.\n gfx.moveTo(c.x, c.y);\n gfx.lineTo(c.x + collider.worldTransform.cos * r, c.y + collider.worldTransform.sin * r);\n\n return;\n }\n\n if (collider.shape.type === 'capsule') {\n this._strokeCapsule(gfx, collider.worldVertices, collider.shape.radius);\n\n return;\n }\n\n if (collider.shape.type === 'segment') {\n const ends = collider.worldVertices;\n\n gfx.moveTo(ends[0]!, ends[1]!);\n gfx.lineTo(ends[2]!, ends[3]!);\n\n return;\n }\n\n if (collider.shape.type === 'chain') {\n // A chain keeps no world geometry of its own - its edge proxies do, and\n // drawing them is drawing exactly what the solver sees, closing edge\n // included.\n for (const edge of collider.chainEdges ?? []) {\n const ends = edge.worldVertices;\n\n gfx.moveTo(ends[0]!, ends[1]!);\n gfx.lineTo(ends[2]!, ends[3]!);\n }\n\n return;\n }\n\n const verts = collider.worldVertices;\n const count = collider.shape.count;\n\n gfx.moveTo(verts[0]!, verts[1]!);\n\n for (let i = 1; i <= count; i++) {\n const j = i % count;\n\n gfx.lineTo(verts[j * 2]!, verts[j * 2 + 1]!);\n }\n }\n\n /**\n * Capsule outline: the two straight sides offset from the spine, joined by a\n * half-circle at each end. The arcs are approximated - a visualisation may\n * tessellate, the solver never does.\n */\n private _strokeCapsule(gfx: Graphics, spine: readonly number[], radius: number): void {\n const ax = spine[0]!;\n const ay = spine[1]!;\n const bx = spine[2]!;\n const by = spine[3]!;\n const along = Math.atan2(by - ay, bx - ax);\n const arcSegments = 12;\n\n gfx.moveTo(ax + Math.cos(along + Math.PI / 2) * radius, ay + Math.sin(along + Math.PI / 2) * radius);\n gfx.lineTo(bx + Math.cos(along + Math.PI / 2) * radius, by + Math.sin(along + Math.PI / 2) * radius);\n\n for (let i = 1; i <= arcSegments; i++) {\n const angle = along + Math.PI / 2 - (Math.PI * i) / arcSegments;\n\n gfx.lineTo(bx + Math.cos(angle) * radius, by + Math.sin(angle) * radius);\n }\n\n for (let i = 1; i <= arcSegments; i++) {\n const angle = along - Math.PI / 2 - (Math.PI * i) / arcSegments;\n\n gfx.lineTo(ax + Math.cos(angle) * radius, ay + Math.sin(angle) * radius);\n }\n }\n\n private _strokeAabb(gfx: Graphics, collider: Collider): void {\n const box = collider.aabb;\n\n gfx.lineColor = colorAabb;\n gfx.moveTo(box.minX, box.minY);\n gfx.lineTo(box.maxX, box.minY);\n gfx.lineTo(box.maxX, box.maxY);\n gfx.lineTo(box.minX, box.maxY);\n gfx.lineTo(box.minX, box.minY);\n }\n\n private _strokeCircle(gfx: Graphics, cx: number, cy: number, r: number): void {\n gfx.moveTo(cx + r, cy);\n\n for (let i = 1; i <= segments; i++) {\n const a = (i / segments) * Math.PI * 2;\n\n gfx.lineTo(cx + Math.cos(a) * r, cy + Math.sin(a) * r);\n }\n }\n\n private _strokeCross(gfx: Graphics, x: number, y: number, size: number): void {\n gfx.moveTo(x - size, y);\n gfx.lineTo(x + size, y);\n gfx.moveTo(x, y - size);\n gfx.lineTo(x, y + size);\n }\n\n /**\n * Recomputes candidate pairs from scratch for the current frame via a plain\n * brute-force AABB-overlap scan - deliberately NOT `AabbTreeBroadPhase`.\n * That class relies on `Collider._treeProxy`, a field shared on the\n * Collider object and valid only for whichever ONE broad phase currently\n * owns it (the world's own `NativePhysicsBackend`); a second instance here\n * would silently corrupt that ownership every time debug draw and a\n * physics step interleave. Debug-only/opt-in (tree-shaken from production\n * bundles), recomputed from scratch every visible frame regardless, so an\n * O(n^2) scan is an appropriate, fully self-contained trade for\n * correctness - it touches no state outside this method.\n */\n private _collectPairs(): void {\n // The solver-side geometry: a chain contributes one leaf per edge, which is\n // both what the broad phase pairs and what the narrow phase can solve.\n const colliders = this._world.detectionGeometry;\n const pairs = this._pairs;\n\n pairs.length = 0;\n\n for (let i = 0; i < colliders.length; i++) {\n const a = colliders[i]!;\n\n for (let j = i + 1; j < colliders.length; j++) {\n const b = colliders[j]!;\n\n if (a.body !== b.body && aabbOverlap(a.aabb, b.aabb)) {\n pairs.push(a.id < b.id ? { a, b } : { a: b, b: a });\n }\n }\n }\n }\n\n private _renderBroadphase(gfx: Graphics): void {\n this._collectPairs();\n gfx.lineColor = colorBroadphase;\n\n for (const pair of this._pairs) {\n const a = pair.a.aabb;\n const b = pair.b.aabb;\n\n gfx.moveTo((a.minX + a.maxX) * 0.5, (a.minY + a.maxY) * 0.5);\n gfx.lineTo((b.minX + b.maxX) * 0.5, (b.minY + b.maxY) * 0.5);\n }\n }\n\n private _renderContacts(gfx: Graphics): void {\n this._collectPairs();\n\n for (const pair of this._pairs) {\n const a = pair.a;\n const b = pair.b;\n\n // Material and sensor state live on the authored collider; an edge proxy\n // reads them from its chain.\n if (authoredCollider(a).isSensor || authoredCollider(b).isSensor) {\n continue;\n }\n\n if (!collide(a, b, this._manifold)) {\n continue;\n }\n\n for (let i = 0; i < this._manifold.pointCount; i++) {\n // i in 0..pointCount-1 and pointCount ≤ 2, so the point always exists.\n const point = i === 0 ? this._manifold.points[0] : this._manifold.points[1];\n\n if (this.options.drawContacts) {\n gfx.lineColor = colorContact;\n this._strokeCross(gfx, point.x, point.y, 3);\n }\n\n if (this.options.drawNormals) {\n gfx.lineColor = colorNormal;\n gfx.moveTo(point.x, point.y);\n gfx.lineTo(point.x + this._manifold.normalX * 12, point.y + this._manifold.normalY * 12);\n }\n }\n }\n }\n}\n\nconst colorForType = (type: BodyType): Color => {\n if (type === 'static') {\n return colorStatic;\n }\n\n return type === 'kinematic' ? colorKinematic : colorDynamic;\n};\n"],"mappings":";;;;;;;;AAmCA,MAAM,WAAW;;AAGjB,MAAM,aAAa,GAAW,GAAW,GAAW,MAAqB,IAAI,MAAM,KAAK,MAAM,IAAI,GAAG,GAAG,KAAK,MAAM,IAAI,GAAG,GAAG,KAAK,MAAM,IAAI,GAAG,GAAG,CAAC;AAEnJ,MAAM,cAAc,UAAU,IAAK,IAAK,IAAK,EAAG;AAChD,MAAM,iBAAiB,UAAU,IAAK,IAAK,GAAG,EAAG;AACjD,MAAM,eAAe,UAAU,GAAG,KAAM,IAAK,EAAG;AAChD,MAAM,cAAc,UAAU,GAAG,IAAK,GAAG,EAAG;AAC5C,MAAM,YAAY,UAAU,IAAK,IAAK,IAAK,EAAG;AAC9C,MAAM,eAAe,UAAU,GAAG,IAAK,IAAK,CAAC;AAC7C,MAAM,cAAc,UAAU,GAAG,IAAK,IAAK,CAAC;AAC5C,MAAM,cAAc,UAAU,GAAG,GAAG,GAAG,EAAG;AAC1C,MAAM,kBAAkB,UAAU,IAAK,IAAK,IAAK,EAAG;AACpD,MAAM,gBAAgB,UAAU,KAAM,KAAM,IAAK,EAAG;AACpD,MAAM,aAAa,UAAU,IAAK,IAAK,GAAG,EAAG;;;;;;;;AAS7C,IAAa,mBAAb,cAAsC,WAAW;;CAE/C,AAAgB;CAEhB,AAAiB;CACjB,AAAQ,YAA6B;CACrC,AAAiB,YAAY,IAAI,SAAS;CAC1C,AAAiB,SAA0B,CAAC;CAE5C,AAAO,YAAY,KAAkB,OAAqB,UAAmC,CAAC,GAAG;EAC/F,MAAM,GAAG;EAET,KAAK,SAAS;EACd,KAAK,UAAU;GACb,YAAY,QAAQ,cAAc;GAClC,UAAU,QAAQ,Y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gBAAgB,KAAqB;EAC3C,KAAK,cAAc;EAEnB,KAAK,MAAM,QAAQ,KAAK,QAAQ;GAC9B,MAAM,IAAI,KAAK;GACf,MAAM,IAAI,KAAK;GAIf,IAAI,iBAAiB,CAAC,CAAC,CAAC,YAAY,iBAAiB,CAAC,CAAC,CAAC,UACtD;GAGF,IAAI,CAAC,QAAQ,GAAG,GAAG,KAAK,SAAS,GAC/B;GAGF,KAAK,IAAI,IAAI,GAAG,IAAI,KAAK,UAAU,YAAY,KAAK;IAElD,MAAM,QAAQ,MAAM,IAAI,KAAK,UAAU,OAAO,KAAK,KAAK,UAAU,OAAO;IAEzE,IAAI,KAAK,QAAQ,cAAc;KAC7B,IAAI,YAAY;KAChB,KAAK,aAAa,KAAK,MAAM,GAAG,MAAM,GAAG,CAAC;IAC5C;IAEA,IAAI,KAAK,QAAQ,aAAa;KAC5B,IAAI,YAAY;KAChB,IAAI,OAAO,MAAM,GAAG,MAAM,CAAC;KAC3B,IAAI,OAAO,MAAM,IAAI,KAAK,UAAU,UAAU,IAAI,MAAM,IAAI,KAAK,UAAU,UAAU,EAAE;IACzF;GACF;EACF;CACF;AACF;AAEA,MAAM,gBAAgB,SAA0B;CAC9C,IAAI,SAAS,UACX,OAAO;CAGT,OAAO,SAAS,cAAc,iBAAiB;AACjD"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/debug/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,KAAK,uBAAuB,EAAE,MAAM,oBAAoB,CAAC"}
|
package/dist/esm/debug/index.js
DELETED
package/dist/esm/events.d.ts
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import type { Collider } from './Collider';
|
|
2
|
-
import type { PhysicsBody } from './PhysicsBody';
|
|
3
|
-
/** A single contact point on a {@link CollisionEvent}. World space. */
|
|
4
|
-
export interface ContactPoint {
|
|
5
|
-
readonly x: number;
|
|
6
|
-
readonly y: number;
|
|
7
|
-
/** Penetration depth in px (≥ 0). */
|
|
8
|
-
readonly penetration: number;
|
|
9
|
-
}
|
|
10
|
-
/**
|
|
11
|
-
* Immutable per-dispatch snapshot describing a solid (non-sensor) contact.
|
|
12
|
-
* Frozen: it is safe to read during the callback and to copy fields out, but it
|
|
13
|
-
* is never reused or mutated, so the classic "stored a pooled event" bug cannot
|
|
14
|
-
* occur. `normal` points from collider/body **A toward B**.
|
|
15
|
-
*/
|
|
16
|
-
export interface CollisionEvent {
|
|
17
|
-
readonly bodyA: PhysicsBody;
|
|
18
|
-
readonly bodyB: PhysicsBody;
|
|
19
|
-
readonly colliderA: Collider;
|
|
20
|
-
readonly colliderB: Collider;
|
|
21
|
-
readonly normal: Readonly<{
|
|
22
|
-
x: number;
|
|
23
|
-
y: number;
|
|
24
|
-
}>;
|
|
25
|
-
readonly points: readonly ContactPoint[];
|
|
26
|
-
}
|
|
27
|
-
/**
|
|
28
|
-
* Immutable per-dispatch snapshot for a sensor overlap. `sensor` is the
|
|
29
|
-
* sensor-flagged collider; `other` is the collider that entered/left it. When
|
|
30
|
-
* both colliders are sensors, the lower-id collider is reported as `sensor`.
|
|
31
|
-
*/
|
|
32
|
-
export interface SensorEvent {
|
|
33
|
-
readonly sensor: Collider;
|
|
34
|
-
readonly other: Collider;
|
|
35
|
-
}
|
|
36
|
-
//# sourceMappingURL=events.d.ts.map
|
package/dist/esm/events.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../../src/events.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAEjD,uEAAuE;AACvE,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAC;IACnB,qCAAqC;IACrC,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;CAC9B;AAED;;;;;GAKG;AACH,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,KAAK,EAAE,WAAW,CAAC;IAC5B,QAAQ,CAAC,KAAK,EAAE,WAAW,CAAC;IAC5B,QAAQ,CAAC,SAAS,EAAE,QAAQ,CAAC;IAC7B,QAAQ,CAAC,SAAS,EAAE,QAAQ,CAAC;IAC7B,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IACpD,QAAQ,CAAC,MAAM,EAAE,SAAS,YAAY,EAAE,CAAC;CAC1C;AAED;;;;GAIG;AACH,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC;IAC1B,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAC;CAC1B"}
|
package/dist/esm/index.d.ts
DELETED
package/dist/esm/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAIA,cAAc,UAAU,CAAC"}
|
package/dist/esm/index.js
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { PhysicsBinding } from "./binding/PhysicsBinding.js";
|
|
2
|
-
import { defaultFilter, shouldCollide } from "./types.js";
|
|
3
|
-
import { Collider } from "./Collider.js";
|
|
4
|
-
import { Joint } from "./joints/Joint.js";
|
|
5
|
-
import { DistanceJoint } from "./joints/DistanceJoint.js";
|
|
6
|
-
import { PhysicsBody } from "./PhysicsBody.js";
|
|
7
|
-
import { MouseJoint } from "./joints/MouseJoint.js";
|
|
8
|
-
import { PrismaticJoint } from "./joints/PrismaticJoint.js";
|
|
9
|
-
import { RevoluteJoint } from "./joints/RevoluteJoint.js";
|
|
10
|
-
import { WeldJoint } from "./joints/WeldJoint.js";
|
|
11
|
-
import { WheelJoint } from "./joints/WheelJoint.js";
|
|
12
|
-
import { PhysicsBodyComponent } from "./PhysicsBodyComponent.js";
|
|
13
|
-
import { physicsBuildInfo } from "./physicsBuildInfo.js";
|
|
14
|
-
import { Shape } from "./shapes/Shape.js";
|
|
15
|
-
import { SegmentShape } from "./shapes/SegmentShape.js";
|
|
16
|
-
import { TimeStepper } from "./TimeStepper.js";
|
|
17
|
-
import { PhysicsWorld } from "./PhysicsWorld.js";
|
|
18
|
-
import { PolygonShape } from "./shapes/PolygonShape.js";
|
|
19
|
-
import { BoxShape } from "./shapes/BoxShape.js";
|
|
20
|
-
import { CapsuleShape } from "./shapes/CapsuleShape.js";
|
|
21
|
-
import { ChainShape } from "./shapes/ChainShape.js";
|
|
22
|
-
import { CircleShape } from "./shapes/CircleShape.js";
|
|
23
|
-
import { toConvexPolygonShapes } from "./shapes/convexParts.js";
|
|
24
|
-
|
|
25
|
-
export { BoxShape, CapsuleShape, ChainShape, CircleShape, Collider, DistanceJoint, Joint, MouseJoint, PhysicsBinding, PhysicsBody, PhysicsBodyComponent, PhysicsWorld, PolygonShape, PrismaticJoint, RevoluteJoint, SegmentShape, Shape, TimeStepper, WeldJoint, WheelJoint, defaultFilter, physicsBuildInfo, shouldCollide, toConvexPolygonShapes };
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
import type { PointLike } from '@codexo/exojs';
|
|
2
|
-
import type { PhysicsBody } from '../PhysicsBody';
|
|
3
|
-
import type { JointOptions } from './Joint';
|
|
4
|
-
import { Joint } from './Joint';
|
|
5
|
-
/** Construction options for a {@link DistanceJoint}. */
|
|
6
|
-
export interface DistanceJointOptions extends JointOptions {
|
|
7
|
-
/** First body (often a static anchor). */
|
|
8
|
-
bodyA: PhysicsBody;
|
|
9
|
-
/** Second body. */
|
|
10
|
-
bodyB: PhysicsBody;
|
|
11
|
-
/** World-space anchor on body A at creation. Default: body A's position. */
|
|
12
|
-
anchorA?: Readonly<PointLike>;
|
|
13
|
-
/** World-space anchor on body B at creation. Default: body B's position. */
|
|
14
|
-
anchorB?: Readonly<PointLike>;
|
|
15
|
-
/** Target distance between the anchors. Default: their initial distance. */
|
|
16
|
-
length?: number;
|
|
17
|
-
/** Soft-spring frequency in Hz; `0` (default) makes it a rigid constraint. */
|
|
18
|
-
hertz?: number;
|
|
19
|
-
/** Soft-spring damping ratio (used when `hertz > 0`). Default `1`. */
|
|
20
|
-
dampingRatio?: number;
|
|
21
|
-
/**
|
|
22
|
-
* Minimum allowed distance. Specifying `minLength` and/or `maxLength` turns the
|
|
23
|
-
* joint into a **rope/limit** (distance kept within `[minLength, maxLength]`,
|
|
24
|
-
* slack between, rigid limits). Otherwise the joint is a rigid/soft **equality**
|
|
25
|
-
* at `length`. Defaults to `0` in limit mode.
|
|
26
|
-
*/
|
|
27
|
-
minLength?: number;
|
|
28
|
-
/** Maximum allowed distance (the rope length). See {@link minLength}. Defaults to `Infinity` in limit mode. */
|
|
29
|
-
maxLength?: number;
|
|
30
|
-
}
|
|
31
|
-
/**
|
|
32
|
-
* Holds the anchor points on two bodies at a target {@link length} along their
|
|
33
|
-
* connecting axis. With `hertz === 0` it is rigid; with `hertz > 0` it behaves
|
|
34
|
-
* as a damped spring. Solved as a soft constraint in the sub-step loop, warm-
|
|
35
|
-
* started across frames.
|
|
36
|
-
*/
|
|
37
|
-
export declare class DistanceJoint extends Joint {
|
|
38
|
-
/** Target distance between the anchors. */
|
|
39
|
-
length: number;
|
|
40
|
-
/** Soft-spring frequency in Hz (`0` = rigid). */
|
|
41
|
-
hertz: number;
|
|
42
|
-
/** Soft-spring damping ratio. */
|
|
43
|
-
dampingRatio: number;
|
|
44
|
-
/** Minimum allowed distance (rope/limit mode). */
|
|
45
|
-
minLength: number;
|
|
46
|
-
/** Maximum allowed distance (rope/limit mode). */
|
|
47
|
-
maxLength: number;
|
|
48
|
-
private readonly _limited;
|
|
49
|
-
private _minImpulse;
|
|
50
|
-
private _maxImpulse;
|
|
51
|
-
private readonly _localAnchorAx;
|
|
52
|
-
private readonly _localAnchorAy;
|
|
53
|
-
private readonly _localAnchorBx;
|
|
54
|
-
private readonly _localAnchorBy;
|
|
55
|
-
private _rAx;
|
|
56
|
-
private _rAy;
|
|
57
|
-
private _rBx;
|
|
58
|
-
private _rBy;
|
|
59
|
-
private _nx;
|
|
60
|
-
private _ny;
|
|
61
|
-
private _separation;
|
|
62
|
-
private _effMass;
|
|
63
|
-
private _biasRate;
|
|
64
|
-
private _massScale;
|
|
65
|
-
private _impulseScale;
|
|
66
|
-
private _impulse;
|
|
67
|
-
constructor(options: DistanceJointOptions);
|
|
68
|
-
private _applyAxisImpulse;
|
|
69
|
-
}
|
|
70
|
-
//# sourceMappingURL=DistanceJoint.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"DistanceJoint.d.ts","sourceRoot":"","sources":["../../../src/joints/DistanceJoint.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAG/C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,KAAK,EAAE,YAAY,EAAiB,MAAM,SAAS,CAAC;AAC3D,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAEhC,wDAAwD;AACxD,MAAM,WAAW,oBAAqB,SAAQ,YAAY;IACxD,0CAA0C;IAC1C,KAAK,EAAE,WAAW,CAAC;IACnB,mBAAmB;IACnB,KAAK,EAAE,WAAW,CAAC;IACnB,4EAA4E;IAC5E,OAAO,CAAC,EAAE,QAAQ,CAAC,SAAS,CAAC,CAAC;IAC9B,4EAA4E;IAC5E,OAAO,CAAC,EAAE,QAAQ,CAAC,SAAS,CAAC,CAAC;IAC9B,4EAA4E;IAC5E,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,8EAA8E;IAC9E,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,sEAAsE;IACtE,YAAY,CAAC,EA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
|
-
|
|
4
|
-
//#region src/joints/DistanceJoint.ts
|
|
5
|
-
/** Reused output sink - physics steps single-threaded, so a shared scratch is safe. */
|
|
6
|
-
const scratch = {
|
|
7
|
-
x: 0,
|
|
8
|
-
y: 0
|
|
9
|
-
};
|
|
10
|
-
/**
|
|
11
|
-
* Holds the anchor points on two bodies at a target {@link length} along their
|
|
12
|
-
* connecting axis. With `hertz === 0` it is rigid; with `hertz > 0` it behaves
|
|
13
|
-
* as a damped spring. Solved as a soft constraint in the sub-step loop, warm-
|
|
14
|
-
* started across frames.
|
|
15
|
-
*/
|
|
16
|
-
var DistanceJoint = class extends Joint {
|
|
17
|
-
/** Target distance between the anchors. */
|
|
18
|
-
length;
|
|
19
|
-
/** Soft-spring frequency in Hz (`0` = rigid). */
|
|
20
|
-
hertz;
|
|
21
|
-
/** Soft-spring damping ratio. */
|
|
22
|
-
dampingRatio;
|
|
23
|
-
/** Minimum allowed distance (rope/limit mode). */
|
|
24
|
-
minLength;
|
|
25
|
-
/** Maximum allowed distance (rope/limit mode). */
|
|
26
|
-
maxLength;
|
|
27
|
-
_limited;
|
|
28
|
-
_minImpulse = -Infinity;
|
|
29
|
-
_maxImpulse = Infinity;
|
|
30
|
-
_localAnchorAx;
|
|
31
|
-
_localAnchorAy;
|
|
32
|
-
_localAnchorBx;
|
|
33
|
-
_localAnchorBy;
|
|
34
|
-
_rAx = 0;
|
|
35
|
-
_rAy = 0;
|
|
36
|
-
_rBx = 0;
|
|
37
|
-
_rBy = 0;
|
|
38
|
-
_nx = 0;
|
|
39
|
-
_ny = 0;
|
|
40
|
-
_separation = 0;
|
|
41
|
-
_effMass = 0;
|
|
42
|
-
_biasRate = 0;
|
|
43
|
-
_massScale = 1;
|
|
44
|
-
_impulseScale = 0;
|
|
45
|
-
_impulse = 0;
|
|
46
|
-
constructor(options) {
|
|
47
|
-
super(options.bodyA, options.bodyB, options.collideConnected);
|
|
48
|
-
const ax = options.anchorA?.x ?? options.bodyA.x;
|
|
49
|
-
const ay = options.anchorA?.y ?? options.bodyA.y;
|
|
50
|
-
const bx = options.anchorB?.x ?? options.bodyB.x;
|
|
51
|
-
const by = options.anchorB?.y ?? options.bodyB.y;
|
|
52
|
-
applyInverseTransform(options.bodyA.transform, ax, ay, scratch);
|
|
53
|
-
this._localAnchorAx = scratch.x;
|
|
54
|
-
this._localAnchorAy = scratch.y;
|
|
55
|
-
applyInverseTransform(options.bodyB.transform, bx, by, scratch);
|
|
56
|
-
this._localAnchorBx = scratch.x;
|
|
57
|
-
this._localAnchorBy = scratch.y;
|
|
58
|
-
this.length = options.length ?? Math.hypot(bx - ax, by - ay);
|
|
59
|
-
this.hertz = options.hertz ?? 0;
|
|
60
|
-
this.dampingRatio = options.dampingRatio ?? 1;
|
|
61
|
-
this._limited = options.minLength !== void 0 || options.maxLength !== void 0;
|
|
62
|
-
this.minLength = options.minLength ?? (this._limited ? 0 : this.length);
|
|
63
|
-
this.maxLength = options.maxLength ?? (this._limited ? Infinity : this.length);
|
|
64
|
-
}
|
|
65
|
-
/** @internal */
|
|
66
|
-
_prepare(h, rigid) {
|
|
67
|
-
const bodyA = this.bodyA;
|
|
68
|
-
const bodyB = this.bodyB;
|
|
69
|
-
this._active = this.enabled && !bodyA.isSleeping && !bodyB.isSleeping && (bodyA.invMass > 0 || bodyB.invMass > 0);
|
|
70
|
-
if (!this._active) return;
|
|
71
|
-
applyTransform(bodyA.transform, this._localAnchorAx, this._localAnchorAy, scratch);
|
|
72
|
-
const pAx = scratch.x;
|
|
73
|
-
const pAy = scratch.y;
|
|
74
|
-
applyTransform(bodyB.transform, this._localAnchorBx, this._localAnchorBy, scratch);
|
|
75
|
-
const pBx = scratch.x;
|
|
76
|
-
const pBy = scratch.y;
|
|
77
|
-
this._rAx = pAx - bodyA.worldCenterOfMassX;
|
|
78
|
-
this._rAy = pAy - bodyA.worldCenterOfMassY;
|
|
79
|
-
this._rBx = pBx - bodyB.worldCenterOfMassX;
|
|
80
|
-
this._rBy = pBy - bodyB.worldCenterOfMassY;
|
|
81
|
-
let dx = pBx - pAx;
|
|
82
|
-
let dy = pBy - pAy;
|
|
83
|
-
const len = Math.hypot(dx, dy);
|
|
84
|
-
if (len > 1e-9) {
|
|
85
|
-
dx /= len;
|
|
86
|
-
dy /= len;
|
|
87
|
-
} else {
|
|
88
|
-
dx = 1;
|
|
89
|
-
dy = 0;
|
|
90
|
-
}
|
|
91
|
-
this._nx = dx;
|
|
92
|
-
this._ny = dy;
|
|
93
|
-
const crA = this._rAx * dy - this._rAy * dx;
|
|
94
|
-
const crB = this._rBx * dy - this._rBy * dx;
|
|
95
|
-
const k = bodyA.invMass + bodyB.invMass + bodyA.invInertia * crA * crA + bodyB.invInertia * crB * crB;
|
|
96
|
-
this._effMass = k > 0 ? 1 / k : 0;
|
|
97
|
-
if (this._limited) {
|
|
98
|
-
if (len > this.maxLength) {
|
|
99
|
-
this._separation = len - this.maxLength;
|
|
100
|
-
this._minImpulse = -Infinity;
|
|
101
|
-
this._maxImpulse = 0;
|
|
102
|
-
} else if (len < this.minLength) {
|
|
103
|
-
this._separation = len - this.minLength;
|
|
104
|
-
this._minImpulse = 0;
|
|
105
|
-
this._maxImpulse = Infinity;
|
|
106
|
-
} else {
|
|
107
|
-
this._active = false;
|
|
108
|
-
this._impulse = 0;
|
|
109
|
-
return;
|
|
110
|
-
}
|
|
111
|
-
} else {
|
|
112
|
-
this._separation = len - this.length;
|
|
113
|
-
this._minImpulse = -Infinity;
|
|
114
|
-
this._maxImpulse = Infinity;
|
|
115
|
-
}
|
|
116
|
-
if (this.hertz > 0 && !this._limited) {
|
|
117
|
-
const omega = 2 * Math.PI * this.hertz;
|
|
118
|
-
const a1 = 2 * this.dampingRatio + h * omega;
|
|
119
|
-
const a2 = h * omega * a1;
|
|
120
|
-
const a3 = 1 / (1 + a2);
|
|
121
|
-
this._biasRate = omega / a1;
|
|
122
|
-
this._massScale = a2 * a3;
|
|
123
|
-
this._impulseScale = a3;
|
|
124
|
-
} else {
|
|
125
|
-
this._biasRate = rigid.biasRate;
|
|
126
|
-
this._massScale = rigid.massScale;
|
|
127
|
-
this._impulseScale = rigid.impulseScale;
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
/** @internal */
|
|
131
|
-
_warmStart() {
|
|
132
|
-
if (this._active) this._applyAxisImpulse(this._impulse);
|
|
133
|
-
}
|
|
134
|
-
/** @internal */
|
|
135
|
-
_solve(useBias) {
|
|
136
|
-
if (!this._active) return;
|
|
137
|
-
const bodyA = this.bodyA;
|
|
138
|
-
const bodyB = this.bodyB;
|
|
139
|
-
const vax = bodyA.linearVelocityX - bodyA.angularVelocity * this._rAy;
|
|
140
|
-
const vay = bodyA.linearVelocityY + bodyA.angularVelocity * this._rAx;
|
|
141
|
-
const vbx = bodyB.linearVelocityX - bodyB.angularVelocity * this._rBy;
|
|
142
|
-
const vby = bodyB.linearVelocityY + bodyB.angularVelocity * this._rBx;
|
|
143
|
-
const cdot = (vbx - vax) * this._nx + (vby - vay) * this._ny;
|
|
144
|
-
const bias = useBias ? this._biasRate * this._separation : 0;
|
|
145
|
-
const raw = -this._effMass * this._massScale * (cdot + bias) - this._impulseScale * this._impulse;
|
|
146
|
-
const clamped = Math.min(this._maxImpulse, Math.max(this._minImpulse, this._impulse + raw));
|
|
147
|
-
const applied = clamped - this._impulse;
|
|
148
|
-
this._impulse = clamped;
|
|
149
|
-
this._applyAxisImpulse(applied);
|
|
150
|
-
}
|
|
151
|
-
_applyAxisImpulse(impulse) {
|
|
152
|
-
const jx = impulse * this._nx;
|
|
153
|
-
const jy = impulse * this._ny;
|
|
154
|
-
const bodyA = this.bodyA;
|
|
155
|
-
const bodyB = this.bodyB;
|
|
156
|
-
bodyA.linearVelocityX -= bodyA.invMass * jx;
|
|
157
|
-
bodyA.linearVelocityY -= bodyA.invMass * jy;
|
|
158
|
-
bodyA.angularVelocity -= bodyA.invInertia * (this._rAx * jy - this._rAy * jx);
|
|
159
|
-
bodyB.linearVelocityX += bodyB.invMass * jx;
|
|
160
|
-
bodyB.linearVelocityY += bodyB.invMass * jy;
|
|
161
|
-
bodyB.angularVelocity += bodyB.invInertia * (this._rBx * jy - this._rBy * jx);
|
|
162
|
-
}
|
|
163
|
-
};
|
|
164
|
-
|
|
165
|
-
//#endregion
|
|
166
|
-
export { DistanceJoint };
|
|
167
|
-
//# sourceMappingURL=DistanceJoint.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"DistanceJoint.js","names":[],"sources":["../../../src/joints/DistanceJoint.ts"],"sourcesContent":["import type { PointLike } from '@codexo/exojs';\n\nimport { applyInverseTransform, applyTransform } from '../math';\nimport type { PhysicsBody } from '../PhysicsBody';\nimport type { JointOptions, JointSoftness } from './Joint';\nimport { Joint } from './Joint';\n\n/** Construction options for a {@link DistanceJoint}. */\nexport interface DistanceJointOptions extends JointOptions {\n /** First body (often a static anchor). */\n bodyA: PhysicsBody;\n /** Second body. */\n bodyB: PhysicsBody;\n /** World-space anchor on body A at creation. Default: body A's position. */\n anchorA?: Readonly<PointLike>;\n /** World-space anchor on body B at creation. Default: body B's position. */\n anchorB?: Readonly<PointLike>;\n /** Target distance between the anchors. Default: their initial distance. */\n length?: number;\n /** Soft-spring frequency in Hz; `0` (default) makes it a rigid constraint. */\n hertz?: number;\n /** Soft-spring damping ratio (used when `hertz > 0`). Default `1`. */\n dampingRatio?: number;\n /**\n * Minimum allowed distance. Specifying `minLength` and/or `maxLength` turns the\n * joint into a **rope/limit** (distance kept within `[minLength, maxLength]`,\n * slack between, rigid limits). Otherwise the joint is a rigid/soft **equality**\n * at `length`. Defaults to `0` in limit mode.\n */\n minLength?: number;\n /** Maximum allowed distance (the rope length). See {@link minLength}. Defaults to `Infinity` in limit mode. */\n maxLength?: number;\n}\n\n/** Reused output sink - physics steps single-threaded, so a shared scratch is safe. */\nconst scratch: PointLike = { x: 0, y: 0 };\n\n/**\n * Holds the anchor points on two bodies at a target {@link length} along their\n * connecting axis. With `hertz === 0` it is rigid; with `hertz > 0` it behaves\n * as a damped spring. Solved as a soft constraint in the sub-step loop, warm-\n * started across frames.\n */\nexport class DistanceJoint extends Joint {\n /** Target distance between the anchors. */\n public length: number;\n /** Soft-spring frequency in Hz (`0` = rigid). */\n public hertz: number;\n /** Soft-spring damping ratio. */\n public dampingRatio: number;\n /** Minimum allowed distance (rope/limit mode). */\n public minLength: number;\n /** Maximum allowed distance (rope/limit mode). */\n public maxLength: number;\n\n private readonly _limited: boolean;\n private _minImpulse = -Infinity;\n private _maxImpulse = Infinity;\n private readonly _localAnchorAx: number;\n private readonly _localAnchorAy: number;\n private readonly _localAnchorBx: number;\n private readonly _localAnchorBy: number;\n\n private _rAx = 0;\n private _rAy = 0;\n private _rBx = 0;\n private _rBy = 0;\n private _nx = 0;\n private _ny = 0;\n private _separation = 0;\n private _effMass = 0;\n private _biasRate = 0;\n private _massScale = 1;\n private _impulseScale = 0;\n private _impulse = 0;\n\n public constructor(options: DistanceJointOptions) {\n super(options.bodyA, options.bodyB, options.collideConnected);\n\n const ax = options.anchorA?.x ?? options.bodyA.x;\n const ay = options.anchorA?.y ?? options.bodyA.y;\n const bx = options.anchorB?.x ?? options.bodyB.x;\n const by = options.anchorB?.y ?? options.bodyB.y;\n\n applyInverseTransform(options.bodyA.transform, ax, ay, scratch);\n this._localAnchorAx = scratch.x;\n this._localAnchorAy = scratch.y;\n applyInverseTransform(options.bodyB.transform, bx, by, scratch);\n this._localAnchorBx = scratch.x;\n this._localAnchorBy = scratch.y;\n\n this.length = options.length ?? Math.hypot(bx - ax, by - ay);\n this.hertz = options.hertz ?? 0;\n this.dampingRatio = options.dampingRatio ?? 1;\n this._limited = options.minLength !== undefined || options.maxLength !== undefined;\n this.minLength = options.minLength ?? (this._limited ? 0 : this.length);\n this.maxLength = options.maxLength ?? (this._limited ? Infinity : this.length);\n }\n\n /** @internal */\n public override _prepare(h: number, rigid: JointSoftness): void {\n const bodyA = this.bodyA;\n const bodyB = this.bodyB;\n\n this._active = this.enabled && !bodyA.isSleeping && !bodyB.isSleeping && (bodyA.invMass > 0 || bodyB.invMass > 0);\n\n if (!this._active) {\n return;\n }\n\n applyTransform(bodyA.transform, this._localAnchorAx, this._localAnchorAy, scratch);\n const pAx = scratch.x;\n const pAy = scratch.y;\n applyTransform(bodyB.transform, this._localAnchorBx, this._localAnchorBy, scratch);\n const pBx = scratch.x;\n const pBy = scratch.y;\n\n this._rAx = pAx - bodyA.worldCenterOfMassX;\n this._rAy = pAy - bodyA.worldCenterOfMassY;\n this._rBx = pBx - bodyB.worldCenterOfMassX;\n this._rBy = pBy - bodyB.worldCenterOfMassY;\n\n let dx = pBx - pAx;\n let dy = pBy - pAy;\n const len = Math.hypot(dx, dy);\n\n if (len > 1e-9) {\n dx /= len;\n dy /= len;\n } else {\n dx = 1;\n dy = 0;\n }\n\n this._nx = dx;\n this._ny = dy;\n\n const crA = this._rAx * dy - this._rAy * dx;\n const crB = this._rBx * dy - this._rBy * dx;\n const k = bodyA.invMass + bodyB.invMass + bodyA.invInertia * crA * crA + bodyB.invInertia * crB * crB;\n this._effMass = k > 0 ? 1 / k : 0;\n\n if (this._limited) {\n // Rope/limit: solve only the violated bound; slack between min and max.\n if (len > this.maxLength) {\n this._separation = len - this.maxLength;\n this._minImpulse = -Infinity; // pull together only (tension)\n this._maxImpulse = 0;\n } else if (len < this.minLength) {\n this._separation = len - this.minLength;\n this._minImpulse = 0; // push apart only (compression)\n this._maxImpulse = Infinity;\n } else {\n this._active = false; // slack — nothing to solve this frame\n this._impulse = 0;\n\n return;\n }\n } else {\n this._separation = len - this.length;\n this._minImpulse = -Infinity;\n this._maxImpulse = Infinity;\n }\n\n // Soft spring only for the equality joint; rope limits are rigid.\n if (this.hertz > 0 && !this._limited) {\n // Box2D-v3 soft factors from a damped spring at the sub-step `h`.\n const omega = 2 * Math.PI * this.hertz;\n const a1 = 2 * this.dampingRatio + h * omega;\n const a2 = h * omega * a1;\n const a3 = 1 / (1 + a2);\n\n this._biasRate = omega / a1;\n this._massScale = a2 * a3;\n this._impulseScale = a3;\n } else {\n // The solver's own softness rather than a raw Baumgarte term; see\n // `softConstraint`. An unscaled bias relaxes no impulse, which a chain of\n // these constraints turns into energy.\n this._biasRate = rigid.biasRate;\n this._massScale = rigid.massScale;\n this._impulseScale = rigid.impulseScale;\n }\n }\n\n /** @internal */\n public override _warmStart(): void {\n if (this._active) {\n this._applyAxisImpulse(this._impulse);\n }\n }\n\n /** @internal */\n public override _solve(useBias: boolean): void {\n if (!this._active) {\n return;\n }\n\n const bodyA = this.bodyA;\n const bodyB = this.bodyB;\n\n // Relative velocity of the anchors projected onto the axis.\n const vax = bodyA.linearVelocityX - bodyA.angularVelocity * this._rAy;\n const vay = bodyA.linearVelocityY + bodyA.angularVelocity * this._rAx;\n const vbx = bodyB.linearVelocityX - bodyB.angularVelocity * this._rBy;\n const vby = bodyB.linearVelocityY + bodyB.angularVelocity * this._rBx;\n const cdot = (vbx - vax) * this._nx + (vby - vay) * this._ny;\n\n const bias = useBias ? this._biasRate * this._separation : 0;\n const raw = -this._effMass * this._massScale * (cdot + bias) - this._impulseScale * this._impulse;\n // Clamp the accumulated impulse to the limit's sign range (±Infinity = equality, no clamp).\n const clamped = Math.min(this._maxImpulse, Math.max(this._minImpulse, this._impulse + raw));\n const applied = clamped - this._impulse;\n\n this._impulse = clamped;\n this._applyAxisImpulse(applied);\n }\n\n private _applyAxisImpulse(impulse: number): void {\n const jx = impulse * this._nx;\n const jy = impulse * this._ny;\n const bodyA = this.bodyA;\n const bodyB = this.bodyB;\n\n bodyA.linearVelocityX -= bodyA.invMass * jx;\n bodyA.linearVelocityY -= bodyA.invMass * jy;\n bodyA.angularVelocity -= bodyA.invInertia * (this._rAx * jy - this._rAy * jx);\n bodyB.linearVelocityX += bodyB.invMass * jx;\n bodyB.linearVelocityY += bodyB.invMass * jy;\n bodyB.angularVelocity += bodyB.invInertia * (this._rBx * jy - this._rBy * jx);\n }\n}\n"],"mappings":";;;;;AAmCA,MAAM,UAAqB;CAAE,GAAG;CAAG,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