@margoengine/ragdoll 0.1.0 → 1.0.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/dist/getup.js CHANGED
@@ -1,16 +1,17 @@
1
- import { MargoError as e } from "@margoengine/math/errors";
2
- import { conjugateQuaternion as t, multiplyQuaternions as n, normalizeQuaternion as r, rotateByQuaternion as i, rotationToQuaternion as a } from "@margoengine/math/quat";
1
+ import { t as e } from "./errors-CDwcEs-j.js";
2
+ import { MargoError as t } from "@margoengine/math/errors";
3
+ import { conjugateQuaternion as n, multiplyQuaternions as r, normalizeQuaternion as i, rotateByQuaternion as a, rotationToQuaternion as o } from "@margoengine/math/quat";
3
4
  //#region src/getup.ts
4
- var o = (e) => {
5
- let t = Math.hypot(e[0], e[1], e[2]), n = Math.hypot(e[4], e[5], e[6]), i = Math.hypot(e[8], e[9], e[10]);
6
- return r(a(e, [
5
+ var s = (e) => {
6
+ let t = Math.hypot(e[0], e[1], e[2]), n = Math.hypot(e[4], e[5], e[6]), r = Math.hypot(e[8], e[9], e[10]);
7
+ return i(o(e, [
7
8
  0,
8
9
  0,
9
10
  0,
10
11
  1
11
- ], t, n, i));
12
- }, s = (e) => 2 * Math.atan2(Math.hypot(e[0], e[1], e[2]), Math.abs(e[3]));
13
- function c(e, t) {
12
+ ], t, n, r));
13
+ }, c = (e) => 2 * Math.atan2(Math.hypot(e[0], e[1], e[2]), Math.abs(e[3]));
14
+ function l(e, t) {
14
15
  let n = e[0] * t[0] + e[1] * t[1] + e[2] * t[2], r = Math.hypot(n, e[3]);
15
16
  return r < 1e-9 ? [
16
17
  0,
@@ -24,51 +25,51 @@ function c(e, t) {
24
25
  e[3] / r
25
26
  ];
26
27
  }
27
- var l = class {
28
- constructor(e, t, n) {
29
- this.ragdoll = e, this.animator = t, this.disposed = !1, this.states = {
30
- faceUp: n.faceUp,
31
- faceDown: n.faceDown
28
+ var u = class {
29
+ constructor(t, n, r) {
30
+ this.ragdoll = t, this.animator = n, this.disposed = !1, this.states = {
31
+ faceUp: r.faceUp,
32
+ faceDown: r.faceDown
32
33
  };
33
- for (let e of [
34
- n.faceUp,
35
- n.faceDown,
36
- n.then ?? t.state
37
- ]) if (!Object.hasOwn(t.options.states, e)) throw RangeError(`Unknown animator state "${e}"; pass a state name from the Animator's options.`);
38
- if (this.root = n.root ?? t.animation.model.root, this.then = n.then ?? t.state, this.blend = n.blend ?? .4, this.fade = n.fade ?? .2, !(this.blend >= 0) || this.blend === Infinity || !(this.fade >= 0) || this.fade === Infinity) throw RangeError("Get-up blend and fade must be finite numbers of seconds, 0 or more.");
39
- let r = n.up ?? [
34
+ for (let t of [
35
+ r.faceUp,
36
+ r.faceDown,
37
+ r.then ?? n.state
38
+ ]) if (!Object.hasOwn(n.options.states, t)) throw e(`Unknown animator state "${t}"; pass a state name from the Animator's options.`);
39
+ if (this.root = r.root ?? n.animation.model.root, this.then = r.then ?? n.state, this.blend = r.blend ?? .4, this.fade = r.fade ?? .2, !(this.blend >= 0) || this.blend === Infinity || !(this.fade >= 0) || this.fade === Infinity) throw e("Get-up blend and fade must be finite numbers of seconds, 0 or more.");
40
+ let i = r.up ?? [
40
41
  0,
41
42
  1,
42
43
  0
43
- ], i = Math.hypot(r[0], r[1], r[2]);
44
- if (!(i > 0) || i === Infinity) throw RangeError("Get-up up must be a nonzero finite [x, y, z]; pass the world up, e.g. [0, 1, 0].");
44
+ ], a = Math.hypot(i[0], i[1], i[2]);
45
+ if (!(a > 0) || a === Infinity) throw e("Get-up up must be a nonzero finite [x, y, z]; pass the world up, e.g. [0, 1, 0].");
45
46
  this.up = [
46
- r[0] / i,
47
- r[1] / i,
48
- r[2] / i
47
+ i[0] / a,
48
+ i[1] / a,
49
+ i[2] / a
49
50
  ], this.first = {
50
51
  faceUp: this.sample("faceUp"),
51
52
  faceDown: this.sample("faceDown")
52
53
  };
53
54
  }
54
55
  sample(e) {
55
- let { animator: r } = this, a = r.state, s = r.time, c = r.entryTime, l = this.ragdoll.bones[0].node, u = l.engine.store;
56
- r.cancelFade(), r.transition(this.states[e], 0), r.onPreUpdate(0), u.tick(!1);
57
- let d = this.root.matrix, f = l.matrix, p = t(o(d)), m = {
58
- rotation: n(p, o(f)),
59
- position: i([
56
+ let { animator: t } = this, i = t.state, o = t.time, c = t.entryTime, l = this.ragdoll.bones[0].node, u = l.engine.store;
57
+ t.cancelFade(), t.transition(this.states[e], 0), t.onPreUpdate(0), u.tick(!1);
58
+ let d = this.root.matrix, f = l.matrix, p = n(s(d)), m = {
59
+ rotation: r(p, s(f)),
60
+ position: a([
60
61
  f[12] - d[12],
61
62
  f[13] - d[13],
62
63
  f[14] - d[14]
63
64
  ], p)
64
65
  };
65
- return r.transition(a, 0), r.enterAt(c), r.time = s, r.onPreUpdate(0), u.tick(!1), m;
66
+ return t.transition(i, 0), t.enterAt(c), t.time = o, t.onPreUpdate(0), u.tick(!1), m;
66
67
  }
67
68
  fit(e) {
68
- let r = this.ragdoll.bones[0].body.rotation, i = n(o(this.root.matrix), this.first[e].rotation), a = c(n(r, t(i)), this.up);
69
+ let t = this.ragdoll.bones[0].body.rotation, i = r(s(this.root.matrix), this.first[e].rotation), a = l(r(t, n(i)), this.up);
69
70
  return {
70
71
  turn: a,
71
- mismatch: s(n(t(r), n(a, i)))
72
+ mismatch: c(r(n(t), r(a, i)))
72
73
  };
73
74
  }
74
75
  mismatch(e) {
@@ -77,15 +78,15 @@ var l = class {
77
78
  pick() {
78
79
  return this.live(), this.fit("faceUp").mismatch <= this.fit("faceDown").mismatch ? "faceUp" : "faceDown";
79
80
  }
80
- start(t = {}) {
81
- if (this.live(), !this.ragdoll.active) throw new e("state", "The ragdoll is not limp, so there is nothing to get up from; call activate first.");
82
- if (this.watching) throw new e("state", "A get-up is already running; wait for its promise.");
83
- t.signal?.throwIfAborted();
84
- let r = t.side ?? this.pick(), { turn: a, mismatch: s } = this.fit(r), { animator: c, ragdoll: l, root: u } = this, d = l.bones[0], f = u.engine.store, p = d.body.position, m = u.matrix, h = [
81
+ start(e = {}) {
82
+ if (this.live(), !this.ragdoll.active) throw new t("state", "The ragdoll is not limp, so there is nothing to get up from; call activate first.");
83
+ if (this.watching) throw new t("state", "A get-up is already running; wait for its promise.");
84
+ e.signal?.throwIfAborted();
85
+ let n = e.side ?? this.pick(), { turn: i, mismatch: o } = this.fit(n), { animator: c, ragdoll: l, root: u } = this, d = l.bones[0], f = u.engine.store, p = d.body.position, m = u.matrix, h = [
85
86
  m[12],
86
87
  m[13],
87
88
  m[14]
88
- ], g = this.first[r].position, _ = n(a, o(m)), v = i(g, _), y = this.up.map((e) => -e), b = l.physics.raycast(p, y, {
89
+ ], g = this.first[n].position, _ = r(i, s(m)), v = a(g, _), y = this.up.map((e) => -e), b = l.physics.raycast(p, y, {
89
90
  maxDistance: 100,
90
91
  excludeDynamic: !0,
91
92
  excludeKinematic: !0
@@ -98,27 +99,27 @@ var l = class {
98
99
  C[0] + this.up[0] * w,
99
100
  C[1] + this.up[1] * w,
100
101
  C[2] + this.up[2] * w
101
- ]), f.tick(!1), c.cancelFade(), c.transition(this.states[r], 0), l.deactivate(this.blend), new Promise((e, n) => {
102
+ ]), f.tick(!1), c.cancelFade(), c.transition(this.states[n], 0), l.deactivate(this.blend), new Promise((t, r) => {
102
103
  let i = () => {
103
- this.watching?.(), this.watching = void 0, t.signal?.removeEventListener("abort", a);
104
+ this.watching?.(), this.watching = void 0, e.signal?.removeEventListener("abort", a);
104
105
  }, a = () => {
105
- i(), n(t.signal.reason);
106
+ i(), r(e.signal.reason);
106
107
  };
107
- t.signal?.addEventListener("abort", a, { once: !0 });
108
- let o = c.addLateStep(() => {
109
- c.state === this.states[r] ? c.normalizedTime >= 1 && (c.transition(this.then, this.fade), i(), e({
110
- side: r,
111
- mismatch: s
112
- })) : (i(), e({
113
- side: r,
114
- mismatch: s
108
+ e.signal?.addEventListener("abort", a, { once: !0 });
109
+ let s = c.addLateStep(() => {
110
+ c.state === this.states[n] ? c.normalizedTime >= 1 && (c.transition(this.then, this.fade), i(), t({
111
+ side: n,
112
+ mismatch: o
113
+ })) : (i(), t({
114
+ side: n,
115
+ mismatch: o
115
116
  }));
116
117
  });
117
- this.watching = o;
118
+ this.watching = s;
118
119
  });
119
120
  }
120
121
  live() {
121
- if (this.disposed) throw new e("disposed", "This get-up is disposed; call addGetUp again.");
122
+ if (this.disposed) throw new t("disposed", "This get-up is disposed; call addGetUp again.");
122
123
  }
123
124
  dispose() {
124
125
  this.disposed = !0, this.watching?.(), this.watching = void 0;
@@ -127,9 +128,9 @@ var l = class {
127
128
  this.dispose();
128
129
  }
129
130
  };
130
- function u(e, t, n) {
131
- if (!e?.bones || typeof t?.transition != "function" || !n) throw TypeError("addGetUp needs a Ragdoll, an Animator and options: addGetUp(ragdoll, animator, {faceUp, faceDown}).");
132
- return new l(e, t, n);
131
+ function d(t, n, r) {
132
+ if (!t?.bones || typeof n?.transition != "function" || !r) throw e("addGetUp needs a Ragdoll, an Animator and options: addGetUp(ragdoll, animator, {faceUp, faceDown}).");
133
+ return new u(t, n, r);
133
134
  }
134
135
  //#endregion
135
- export { l as GetUp, u as addGetUp };
136
+ export { u as GetUp, d as addGetUp };
package/dist/hulls.js CHANGED
@@ -1,7 +1,8 @@
1
- import { normalizeQuaternion as e, rotateByQuaternion as t } from "@margoengine/math/quat";
2
- import { jointHulls as n } from "@margoengine/rigging/hulls";
1
+ import { t as e } from "./errors-CDwcEs-j.js";
2
+ import { normalizeQuaternion as t, rotateByQuaternion as n } from "@margoengine/math/quat";
3
+ import { jointHulls as r } from "@margoengine/rigging/hulls";
3
4
  //#region src/hulls.ts
4
- var r = [
5
+ var i = [
5
6
  1,
6
7
  0,
7
8
  0,
@@ -18,39 +19,39 @@ var r = [
18
19
  0,
19
20
  0,
20
21
  1
21
- ], i = 18;
22
- function a(e, t) {
23
- let { doc: n } = e.asset, i = (n.skins ?? []).findIndex((n) => n.joints.some((n) => e.nodes[n] === t));
24
- if (i < 0) throw RangeError("No skin of this model holds the ragdoll's root bone; pass the model the skeleton belongs to.");
25
- let a = e.primitives.filter((e) => n.nodes?.[e.nodeIndex]?.skin === i);
26
- if (!a.length) throw RangeError("No mesh of this model uses the skin; there is nothing to fit shapes to.");
27
- let { joints: o, inverseBindMatrices: s } = n.skins[i], c = a.some((e) => e.definition.attributes?.JOINTS_1 !== void 0) ? 2 : 1, l = c * 4, u = a.map((t) => e.asset.accessor(t.definition.attributes.POSITION, "VEC3")), d = u.reduce((e, t) => e + t.length / 3, 0), f = new Uint16Array(d * l), p = new Float32Array(d * l), m = new Float32Array(d * 3), h = 0;
28
- a.forEach((t, n) => {
29
- let r = u[n].length / 3;
30
- m.set(u[n], h * 3);
31
- for (let n = 0; n < c; n++) {
32
- let i = t.definition.attributes, a = i["JOINTS_" + n], o = i["WEIGHTS_" + n];
22
+ ], a = 18;
23
+ function o(t, n) {
24
+ let { doc: r } = t.asset, a = (r.skins ?? []).findIndex((e) => e.joints.some((e) => t.nodes[e] === n));
25
+ if (a < 0) throw e("No skin of this model holds the ragdoll's root bone; pass the model the skeleton belongs to.");
26
+ let o = t.primitives.filter((e) => r.nodes?.[e.nodeIndex]?.skin === a);
27
+ if (!o.length) throw e("No mesh of this model uses the skin; there is nothing to fit shapes to.");
28
+ let { joints: s, inverseBindMatrices: c } = r.skins[a], l = o.some((e) => e.definition.attributes?.JOINTS_1 !== void 0) ? 2 : 1, u = l * 4, d = o.map((e) => t.asset.accessor(e.definition.attributes.POSITION, "VEC3")), f = d.reduce((e, t) => e + t.length / 3, 0), p = new Uint16Array(f * u), m = new Float32Array(f * u), h = new Float32Array(f * 3), g = 0;
29
+ o.forEach((e, n) => {
30
+ let r = d[n].length / 3;
31
+ h.set(d[n], g * 3);
32
+ for (let n = 0; n < l; n++) {
33
+ let i = e.definition.attributes, a = i["JOINTS_" + n], o = i["WEIGHTS_" + n];
33
34
  if (a === void 0 || o === void 0) continue;
34
- let s = e.asset.accessor(a, "VEC4"), c = e.asset.accessor(o, "VEC4");
35
- for (let e = 0; e < r; e++) for (let t = 0; t < 4; t++) f[(h + e) * l + n * 4 + t] = s[e * 4 + t], p[(h + e) * l + n * 4 + t] = c[e * 4 + t];
35
+ let s = t.asset.accessor(a, "VEC4"), c = t.asset.accessor(o, "VEC4");
36
+ for (let e = 0; e < r; e++) for (let t = 0; t < 4; t++) p[(g + e) * u + n * 4 + t] = s[e * 4 + t], m[(g + e) * u + n * 4 + t] = c[e * 4 + t];
36
37
  }
37
- h += r;
38
+ g += r;
38
39
  });
39
- for (let e = 0; e < d; e++) {
40
+ for (let e = 0; e < f; e++) {
40
41
  let t = 0;
41
- for (let n = 0; n < l; n++) t += p[e * l + n];
42
- if (t > 0) for (let n = 0; n < l; n++) p[e * l + n] /= t;
42
+ for (let n = 0; n < u; n++) t += m[e * u + n];
43
+ if (t > 0) for (let n = 0; n < u; n++) m[e * u + n] /= t;
43
44
  }
44
45
  return {
45
- positions: m,
46
- joints: f,
47
- weights: p,
48
- influences: l,
49
- nodes: o.map((t) => e.nodes[t]),
50
- inverseBindMatrices: s === void 0 ? Float32Array.from(o.flatMap(() => r)) : e.asset.accessor(s, "MAT4")
46
+ positions: h,
47
+ joints: p,
48
+ weights: m,
49
+ influences: u,
50
+ nodes: s.map((e) => t.nodes[e]),
51
+ inverseBindMatrices: c === void 0 ? Float32Array.from(s.flatMap(() => i)) : t.asset.accessor(c, "MAT4")
51
52
  };
52
53
  }
53
- function o(e, t) {
54
+ function s(e, t) {
54
55
  let { parents: n } = e.engine.store;
55
56
  for (let r = e.id; r !== -1; r = n[r]) {
56
57
  let e = t.get(r);
@@ -58,38 +59,38 @@ function o(e, t) {
58
59
  }
59
60
  return -1;
60
61
  }
61
- function s(t) {
62
- return t[1] < -.999999 ? [
62
+ function c(e) {
63
+ return e[1] < -.999999 ? [
63
64
  1,
64
65
  0,
65
66
  0,
66
67
  0
67
- ] : e([
68
- t[2],
68
+ ] : t([
69
+ e[2],
69
70
  0,
70
- -t[0],
71
- 1 + t[1]
71
+ -e[0],
72
+ 1 + e[1]
72
73
  ]);
73
74
  }
74
- var c = (e, t) => [
75
+ var l = (e, t) => [
75
76
  e[3] * t[0] + e[0] * t[3] + e[1] * t[2] - e[2] * t[1],
76
77
  e[3] * t[1] - e[0] * t[2] + e[1] * t[3] + e[2] * t[0],
77
78
  e[3] * t[2] + e[0] * t[1] - e[1] * t[0] + e[2] * t[3],
78
79
  e[3] * t[3] - e[0] * t[0] - e[1] * t[1] - e[2] * t[2]
79
80
  ];
80
- function l(e, n) {
81
- let r = s(n), a, o = Infinity;
82
- for (let n = 0; n < i; n++) {
83
- let s = n / i * Math.PI / 4, l = c(r, [
81
+ function u(e, t) {
82
+ let r = c(t), i, o = Infinity;
83
+ for (let t = 0; t < a; t++) {
84
+ let s = t / a * Math.PI / 4, c = l(r, [
84
85
  0,
85
86
  Math.sin(s),
86
87
  0,
87
88
  Math.cos(s)
88
89
  ]), u = [
89
- -l[0],
90
- -l[1],
91
- -l[2],
92
- l[3]
90
+ -c[0],
91
+ -c[1],
92
+ -c[2],
93
+ c[3]
93
94
  ], d = [
94
95
  Infinity,
95
96
  Infinity,
@@ -99,75 +100,77 @@ function l(e, n) {
99
100
  -Infinity,
100
101
  -Infinity
101
102
  ];
102
- for (let n = 0; n < e.length; n += 3) {
103
- let r = t([
104
- e[n],
105
- e[n + 1],
106
- e[n + 2]
103
+ for (let t = 0; t < e.length; t += 3) {
104
+ let r = n([
105
+ e[t],
106
+ e[t + 1],
107
+ e[t + 2]
107
108
  ], u);
108
109
  for (let e = 0; e < 3; e++) d[e] = Math.min(d[e], r[e]), f[e] = Math.max(f[e], r[e]);
109
110
  }
110
111
  let p = (f[0] - d[0]) * (f[1] - d[1]) * (f[2] - d[2]);
111
- p >= o || (o = p, a = {
112
+ p >= o || (o = p, i = {
112
113
  type: "box",
113
- center: t([
114
+ center: n([
114
115
  0,
115
116
  1,
116
117
  2
117
- ].map((e) => (d[e] + f[e]) / 2), l),
118
+ ].map((e) => (d[e] + f[e]) / 2), c),
118
119
  halfExtents: [
119
120
  (f[0] - d[0]) / 2,
120
121
  (f[1] - d[1]) / 2,
121
122
  (f[2] - d[2]) / 2
122
123
  ],
123
- rotation: l
124
+ rotation: c
124
125
  });
125
126
  }
126
- return a;
127
+ return i;
127
128
  }
128
- function u(e, t, i = {}) {
129
- if (!e?.bones || !t) throw TypeError("fitRagdollShapes needs a Ragdoll and a model: fitRagdollShapes(ragdoll, model).");
130
- let { shape: s = "hull", minWeight: c, maxPoints: u } = i;
131
- if (s !== "hull" && s !== "box") throw RangeError("fitRagdollShapes shape must be 'hull' or 'box'.");
132
- let d = "primitives" in t ? a(t, e.bones[0].node) : t, { nodes: f, inverseBindMatrices: p } = d, m = new Map(e.bones.map((e, t) => [e.node.id, t])), h = new Map(f.flatMap((e) => m.has(e.id) ? [[e.id, m.get(e.id)]] : [])), g = new Float32Array(e.bones.length * 16);
133
- if (!h.size) throw RangeError("The skin holds none of the ragdoll bones; pass the model the skeleton belongs to.");
134
- for (let t = 0; t < e.bones.length; t++) g.set(r, t * 16);
135
- f.forEach((e, t) => {
136
- let n = h.get(e.id);
137
- if (n !== void 0) for (let e = 0; e < 16; e++) g[n * 16 + e] = p[t * 16 + e];
129
+ function d(t, n, a = {}) {
130
+ if (!t?.bones || !n) throw e("fitRagdollShapes needs a Ragdoll and a model: fitRagdollShapes(ragdoll, model).");
131
+ let { shape: c = "hull", minWeight: l, maxPoints: d } = a;
132
+ if (c !== "hull" && c !== "box") throw e("fitRagdollShapes shape must be 'hull' or 'box'.");
133
+ if (l !== void 0 && !(l > 0 && l <= 1)) throw e("fitRagdollShapes minWeight must be above 0 and at most 1; pass a share, e.g. 0.5.");
134
+ if (d !== void 0 && !(Number.isInteger(d) && d >= 8 && d <= 1024)) throw e("fitRagdollShapes maxPoints must be an integer from 8 to 1024, e.g. 64.");
135
+ let f = "primitives" in n ? o(n, t.bones[0].node) : n, { nodes: p, inverseBindMatrices: m } = f, h = new Map(t.bones.map((e, t) => [e.node.id, t])), g = new Map(p.flatMap((e) => h.has(e.id) ? [[e.id, h.get(e.id)]] : [])), _ = new Float32Array(t.bones.length * 16);
136
+ if (!g.size) throw e("The skin holds none of the ragdoll bones; pass the model the skeleton belongs to.");
137
+ for (let e = 0; e < t.bones.length; e++) _.set(i, e * 16);
138
+ p.forEach((e, t) => {
139
+ let n = g.get(e.id);
140
+ if (n !== void 0) for (let e = 0; e < 16; e++) _[n * 16 + e] = m[t * 16 + e];
138
141
  });
139
- let _ = f.map((e) => o(e, h)), v = new Uint16Array(d.joints.length), y = Float32Array.from(d.weights);
140
- for (let e = 0; e < v.length; e++) {
141
- let t = _[d.joints[e]];
142
- if (t === void 0) throw RangeError(`Skin joint ${d.joints[e]} has no node; pass one node per joint.`);
143
- t < 0 ? y[e] = 0 : v[e] = t;
142
+ let v = p.map((e) => s(e, g)), y = new Uint16Array(f.joints.length), b = Float32Array.from(f.weights);
143
+ for (let t = 0; t < y.length; t++) {
144
+ let n = v[f.joints[t]];
145
+ if (n === void 0) throw e(`Skin joint ${f.joints[t]} has no node; pass one node per joint.`);
146
+ n < 0 ? b[t] = 0 : y[t] = n;
144
147
  }
145
- return n({
146
- positions: d.positions,
148
+ return r({
149
+ positions: f.positions,
147
150
  skin: {
148
- joints: v,
149
- weights: y,
150
- influences: d.influences ?? 4
151
+ joints: y,
152
+ weights: b,
153
+ influences: f.influences ?? 4
151
154
  }
152
155
  }, {
153
- minWeight: c,
154
- maxPoints: u,
155
- inverseBindMatrices: g
156
- }).map((t) => {
157
- let n = e.bones[t.joint], r = n.node.matrix, i = [
156
+ minWeight: l,
157
+ maxPoints: d,
158
+ inverseBindMatrices: _
159
+ }).map((e) => {
160
+ let n = t.bones[e.joint], r = n.node.matrix, i = [
158
161
  Math.hypot(r[0], r[1], r[2]),
159
162
  Math.hypot(r[4], r[5], r[6]),
160
163
  Math.hypot(r[8], r[9], r[10])
161
- ], a = t.points.map((e, t) => e * i[t % 3]), o = s === "box" ? l(a, n.axis) : {
164
+ ], a = e.points.map((e, t) => e * i[t % 3]), o = c === "box" ? u(a, n.axis) : {
162
165
  type: "hull",
163
166
  points: a
164
167
  };
165
- return e.setShape(n, o), {
168
+ return t.setShape(n, o), {
166
169
  part: n,
167
170
  shape: o,
168
- vertexCount: t.vertexCount
171
+ vertexCount: e.vertexCount
169
172
  };
170
173
  });
171
174
  }
172
175
  //#endregion
173
- export { u as fitRagdollShapes };
176
+ export { d as fitRagdollShapes };
package/dist/index.d.ts CHANGED
@@ -1,2 +1,2 @@
1
1
  export { Ragdoll } from './ragdoll.js';
2
- export type { RagdollBone, RagdollJoint, RagdollLimb, RagdollOptions, RagdollPart, RagdollSettings, RagdollShape, } from './ragdoll.js';
2
+ export type { RagdollBone, RagdollDebugOptions, RagdollJoint, RagdollLimb, RagdollOptions, RagdollPart, RagdollSettings, RagdollShape, } from './ragdoll.js';