@khr3/core 0.2.10 → 0.2.12
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 -0
- package/dist/KhrAssembly.d.ts +44 -8
- package/dist/KhrCollider.d.ts +25 -7
- package/dist/clone.d.ts +45 -0
- package/dist/decoders.d.ts +30 -0
- package/dist/{khrExporter.d.ts → exporter.d.ts} +2 -2
- package/dist/{khrGlb.d.ts → glb.d.ts} +4 -3
- package/dist/index.d.ts +10 -9
- package/dist/index.js +1087 -926
- package/dist/index.js.map +1 -1
- package/dist/inertia.d.ts +41 -0
- package/dist/joints-5IgWDD2w.js +865 -0
- package/dist/joints-5IgWDD2w.js.map +1 -0
- package/dist/{jointDynamics.d.ts → joints.d.ts} +10 -7
- package/dist/loader.d.ts +9 -0
- package/dist/types.d.ts +284 -0
- package/dist/useKhrGlb.d.ts +6 -1
- package/dist/vehicle.d.ts +22 -2
- package/dist/vehicle.js +617 -665
- package/dist/vehicle.js.map +1 -1
- package/dist/vehicleJoints.d.ts +50 -0
- package/dist/wheelLoads.d.ts +5 -4
- package/package.json +4 -16
- package/dist/AssemblyRootBody.d.ts +0 -16
- package/dist/BundleSceneHost.d.ts +0 -23
- package/dist/KhrVehicle.d.ts +0 -20
- package/dist/assemblyPlan.d.ts +0 -61
- package/dist/curves.d.ts +0 -378
- package/dist/curves.js +0 -542
- package/dist/curves.js.map +0 -1
- package/dist/khrBundleFinalize.d.ts +0 -15
- package/dist/khrClone.d.ts +0 -14
- package/dist/khrConfigTypes.d.ts +0 -62
- package/dist/khrExportEncoders.d.ts +0 -8
- package/dist/khrExtras.d.ts +0 -22
- package/dist/khrInertia.d.ts +0 -18
- package/dist/khrJointParser.d.ts +0 -3
- package/dist/khrLoader.d.ts +0 -7
- package/dist/khrMassProps.d.ts +0 -16
- package/dist/khrParsers.d.ts +0 -10
- package/dist/khrPlugin.d.ts +0 -8
- package/dist/khrPluginHelpers.d.ts +0 -26
- package/dist/khrRotorDecoders.d.ts +0 -4
- package/dist/khrShapeParser.d.ts +0 -8
- package/dist/khrTypes.d.ts +0 -141
- package/dist/khrVehicleChassis.d.ts +0 -20
- package/dist/khrVehicleJointHelpers.d.ts +0 -37
- package/dist/khrVehicleJoints.d.ts +0 -30
- package/dist/khrVehicleRotors.d.ts +0 -22
- package/dist/khrVehicleSlots.d.ts +0 -41
- package/dist/khrVehicleTypes.d.ts +0 -52
- package/dist/pacejka.d.ts +0 -22
- package/dist/physicsEcs-Bi0ikONC.js +0 -1156
- package/dist/physicsEcs-Bi0ikONC.js.map +0 -1
- package/dist/physicsEcs.d.ts +0 -25
package/dist/curves.js
DELETED
|
@@ -1,542 +0,0 @@
|
|
|
1
|
-
// src/pacejka.ts
|
|
2
|
-
var HALF_PI = Math.PI * .5;
|
|
3
|
-
var MIN_KNOT_SPACING = .01;
|
|
4
|
-
var MAX_TANGENT_SECANT_RATIO = 2.85;
|
|
5
|
-
var MAX_RAD = 1.54;
|
|
6
|
-
function clamp(v, lo, hi) {
|
|
7
|
-
return v < lo ? lo : v > hi ? hi : v;
|
|
8
|
-
}
|
|
9
|
-
function uVal(x, axis) {
|
|
10
|
-
return axis === "lat" ? Math.sin(HALF_PI * x) : x;
|
|
11
|
-
}
|
|
12
|
-
function duVal(x, axis) {
|
|
13
|
-
return axis === "lat" ? HALF_PI * Math.cos(HALF_PI * x) : 1;
|
|
14
|
-
}
|
|
15
|
-
function pacejkaPhi(u, B, E) {
|
|
16
|
-
const bu = B * u;
|
|
17
|
-
return bu - E * (bu - Math.atan(bu));
|
|
18
|
-
}
|
|
19
|
-
function pacejkaYRaw(u, B, C, E) {
|
|
20
|
-
return Math.sin(C * Math.atan(pacejkaPhi(u, B, E)));
|
|
21
|
-
}
|
|
22
|
-
function pacejkaSlopeX(x, B, C, E, axis) {
|
|
23
|
-
const u = uVal(x, axis);
|
|
24
|
-
const bu = B * u;
|
|
25
|
-
const phi = pacejkaPhi(u, B, E);
|
|
26
|
-
const dphiDu = B * (1 - E + E / (1 + bu * bu));
|
|
27
|
-
return C * Math.cos(C * Math.atan(phi)) / (1 + phi * phi) * dphiDu * duVal(x, axis);
|
|
28
|
-
}
|
|
29
|
-
/**
|
|
30
|
-
* Exact 8-knot Fritsch-Carlson monotone Pacejka Magic Formula compiler for `ecctrl/curves`.
|
|
31
|
-
* - `"lng"`: `u = x` matching `ShapeCastWheel` `lngSlipRatio = |w*R - vx| / |vx|`.
|
|
32
|
-
* - `"lat"`: `u = sin((pi/2) * x)` matching `ShapeCastWheel` `latSlipRatio = atan2(|vy|, |vx|) / (pi/2)`.
|
|
33
|
-
*/
|
|
34
|
-
function compilePacejkaCurve(B, C, E, samples = 100, axis = "lng") {
|
|
35
|
-
let xPeak = 1;
|
|
36
|
-
if (C > 1) {
|
|
37
|
-
const targetPhi = Math.tan(Math.PI / (2 * C));
|
|
38
|
-
if (pacejkaPhi(1, B, E) >= targetPhi) {
|
|
39
|
-
let lo = 0;
|
|
40
|
-
let hi = 1;
|
|
41
|
-
for (let iter = 0; iter < 48; iter++) {
|
|
42
|
-
const mid = .5 * (lo + hi);
|
|
43
|
-
if (pacejkaPhi(uVal(mid, axis), B, E) >= targetPhi) hi = mid;
|
|
44
|
-
else lo = mid;
|
|
45
|
-
}
|
|
46
|
-
xPeak = hi;
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
const yPeakRaw = pacejkaYRaw(uVal(xPeak, axis), B, C, E);
|
|
50
|
-
const invYMax = yPeakRaw > 1e-6 ? 1 / yPeakRaw : 1;
|
|
51
|
-
const rawKnots = [
|
|
52
|
-
0,
|
|
53
|
-
.32 * xPeak,
|
|
54
|
-
.68 * xPeak,
|
|
55
|
-
xPeak,
|
|
56
|
-
xPeak + .06 * (1 - xPeak),
|
|
57
|
-
xPeak + .18 * (1 - xPeak),
|
|
58
|
-
xPeak + .48 * (1 - xPeak),
|
|
59
|
-
1
|
|
60
|
-
];
|
|
61
|
-
const knots = [0];
|
|
62
|
-
for (let i = 1; i < rawKnots.length - 1; i++) {
|
|
63
|
-
const k = rawKnots[i];
|
|
64
|
-
if (k - knots[knots.length - 1] >= MIN_KNOT_SPACING && 1 - k >= MIN_KNOT_SPACING) knots.push(k);
|
|
65
|
-
}
|
|
66
|
-
knots.push(1);
|
|
67
|
-
const ys = knots.map((x) => {
|
|
68
|
-
if (x === xPeak && C > 1 && yPeakRaw > 1e-6 && pacejkaPhi(1, B, E) >= Math.tan(Math.PI / (2 * C))) return 1;
|
|
69
|
-
return pacejkaYRaw(uVal(x, axis), B, C, E) * invYMax;
|
|
70
|
-
});
|
|
71
|
-
const secants = [];
|
|
72
|
-
for (let i = 0; i < knots.length - 1; i++) secants.push((ys[i + 1] - ys[i]) / (knots[i + 1] - knots[i]));
|
|
73
|
-
const slopes = knots.map((x, i) => {
|
|
74
|
-
if (x === xPeak && x < 1) return 0;
|
|
75
|
-
const mRaw = pacejkaSlopeX(x, B, C, E, axis) * invYMax;
|
|
76
|
-
if (i === 0) {
|
|
77
|
-
const s = secants[0];
|
|
78
|
-
if (Math.abs(s) <= 1e-9) return 0;
|
|
79
|
-
return clamp(mRaw / s, 0, MAX_TANGENT_SECANT_RATIO) * s;
|
|
80
|
-
}
|
|
81
|
-
if (i === knots.length - 1) {
|
|
82
|
-
const s = secants[secants.length - 1];
|
|
83
|
-
if (Math.abs(s) <= 1e-9) return 0;
|
|
84
|
-
return clamp(mRaw / s, 0, MAX_TANGENT_SECANT_RATIO) * s;
|
|
85
|
-
}
|
|
86
|
-
const sL = secants[i - 1];
|
|
87
|
-
const sR = secants[i];
|
|
88
|
-
if (sL * sR <= 0 || Math.abs(sL) <= 1e-9 || Math.abs(sR) <= 1e-9) return 0;
|
|
89
|
-
const minS = Math.abs(sL) <= Math.abs(sR) ? sL : sR;
|
|
90
|
-
return clamp(mRaw / minS, 0, MAX_TANGENT_SECANT_RATIO) * minS;
|
|
91
|
-
});
|
|
92
|
-
return {
|
|
93
|
-
points: knots.map((x, i) => {
|
|
94
|
-
const ang = clamp(Math.atan(slopes[i]), -1.54, MAX_RAD);
|
|
95
|
-
const pt = {
|
|
96
|
-
x: Number(x.toFixed(6)),
|
|
97
|
-
y: Number(ys[i].toFixed(6))
|
|
98
|
-
};
|
|
99
|
-
if (i > 0) {
|
|
100
|
-
pt.r_in = Number(ang.toFixed(6));
|
|
101
|
-
pt.w_in = 1;
|
|
102
|
-
}
|
|
103
|
-
if (i < knots.length - 1) {
|
|
104
|
-
pt.r_out = Number(ang.toFixed(6));
|
|
105
|
-
pt.w_out = 1;
|
|
106
|
-
}
|
|
107
|
-
return pt;
|
|
108
|
-
}),
|
|
109
|
-
samples
|
|
110
|
-
};
|
|
111
|
-
}
|
|
112
|
-
/** Inverts `ShapeCastWheel` `(rayHitFriction + tireGripFactor) * 0.5 = muPeak`. */
|
|
113
|
-
function tireGripForSurface(muPeakLng, groundColliderFriction = .5) {
|
|
114
|
-
return Number((2 * muPeakLng - groundColliderFriction).toFixed(4));
|
|
115
|
-
}
|
|
116
|
-
/** Converts physical peak engine torque (N*m) into `carConfig.engineHorsepower` (`T * RPM / 7022`). */
|
|
117
|
-
function engineHorsepowerForPeakTorque(peakTorqueNm, engineMaxRPM) {
|
|
118
|
-
return Number((peakTorqueNm * engineMaxRPM / 7022).toFixed(1));
|
|
119
|
-
}
|
|
120
|
-
// src/curves.ts
|
|
121
|
-
var TIRE_ARCHETYPES = {
|
|
122
|
-
hypercarDry: {
|
|
123
|
-
lng: compilePacejkaCurve(11.2, 1.54, -.45, 100, "lng"),
|
|
124
|
-
lat: compilePacejkaCurve(11.6, 1.5, -.4, 100, "lat"),
|
|
125
|
-
muPeakLng: 1.38,
|
|
126
|
-
latFrictionEllipseScale: .97,
|
|
127
|
-
relaxLngRate: .04,
|
|
128
|
-
relaxLatRate: .06
|
|
129
|
-
},
|
|
130
|
-
streetDrift90s: {
|
|
131
|
-
lng: compilePacejkaCurve(8.8, 1.5, -.15, 80, "lng"),
|
|
132
|
-
lat: compilePacejkaCurve(9.2, 1.44, -.12, 80, "lat"),
|
|
133
|
-
muPeakLng: 1.08,
|
|
134
|
-
latFrictionEllipseScale: .97,
|
|
135
|
-
relaxLngRate: .05,
|
|
136
|
-
relaxLatRate: .1
|
|
137
|
-
},
|
|
138
|
-
offroad6x6At: {
|
|
139
|
-
lng: compilePacejkaCurve(6.2, 1.48, -.35, 80, "lng"),
|
|
140
|
-
lat: compilePacejkaCurve(6.6, 1.48, -.3, 80, "lat"),
|
|
141
|
-
muPeakLng: .85,
|
|
142
|
-
latFrictionEllipseScale: .87,
|
|
143
|
-
relaxLngRate: .12,
|
|
144
|
-
relaxLatRate: .24
|
|
145
|
-
},
|
|
146
|
-
gravelRally: {
|
|
147
|
-
lng: compilePacejkaCurve(5.8, 1.26, -.45, 80, "lng"),
|
|
148
|
-
lat: compilePacejkaCurve(6.4, 1.28, -.4, 80, "lat"),
|
|
149
|
-
muPeakLng: .74,
|
|
150
|
-
latFrictionEllipseScale: .92,
|
|
151
|
-
relaxLngRate: .08,
|
|
152
|
-
relaxLatRate: .16
|
|
153
|
-
},
|
|
154
|
-
wetAsphalt: {
|
|
155
|
-
lng: compilePacejkaCurve(12.8, 1.66, -.6, 100, "lng"),
|
|
156
|
-
lat: compilePacejkaCurve(12.2, 1.62, -.55, 100, "lat"),
|
|
157
|
-
muPeakLng: .8,
|
|
158
|
-
latFrictionEllipseScale: .95,
|
|
159
|
-
relaxLngRate: .05,
|
|
160
|
-
relaxLatRate: .09
|
|
161
|
-
},
|
|
162
|
-
snowIce: {
|
|
163
|
-
lng: compilePacejkaCurve(17.5, 1.64, -1.15, 120, "lng"),
|
|
164
|
-
lat: compilePacejkaCurve(16.5, 1.61, -1.05, 120, "lat"),
|
|
165
|
-
muPeakLng: .28,
|
|
166
|
-
latFrictionEllipseScale: .93,
|
|
167
|
-
relaxLngRate: .06,
|
|
168
|
-
relaxLatRate: .12
|
|
169
|
-
}
|
|
170
|
-
};
|
|
171
|
-
var TIRE_SLIP_CURVES = {
|
|
172
|
-
streetRadial: TIRE_ARCHETYPES.streetDrift90s.lng,
|
|
173
|
-
driftProgressive: TIRE_ARCHETYPES.streetDrift90s.lat,
|
|
174
|
-
offroadLug: TIRE_ARCHETYPES.offroad6x6At.lng
|
|
175
|
-
};
|
|
176
|
-
var ENGINE_TORQUE_CURVES = {
|
|
177
|
-
w16QuadTurbo: {
|
|
178
|
-
samples: 80,
|
|
179
|
-
points: [
|
|
180
|
-
{
|
|
181
|
-
x: 0,
|
|
182
|
-
y: .62,
|
|
183
|
-
r_out: .85,
|
|
184
|
-
w_out: 1
|
|
185
|
-
},
|
|
186
|
-
{
|
|
187
|
-
x: .15,
|
|
188
|
-
y: .84,
|
|
189
|
-
r_in: 1.05,
|
|
190
|
-
r_out: 1.05,
|
|
191
|
-
w_in: 1,
|
|
192
|
-
w_out: 1
|
|
193
|
-
},
|
|
194
|
-
{
|
|
195
|
-
x: .27,
|
|
196
|
-
y: 1,
|
|
197
|
-
r_in: 0,
|
|
198
|
-
r_out: 0,
|
|
199
|
-
w_in: 1,
|
|
200
|
-
w_out: 1
|
|
201
|
-
},
|
|
202
|
-
{
|
|
203
|
-
x: .84,
|
|
204
|
-
y: 1,
|
|
205
|
-
r_in: 0,
|
|
206
|
-
r_out: 0,
|
|
207
|
-
w_in: 1,
|
|
208
|
-
w_out: 1
|
|
209
|
-
},
|
|
210
|
-
{
|
|
211
|
-
x: .95,
|
|
212
|
-
y: .962,
|
|
213
|
-
r_in: -.68,
|
|
214
|
-
r_out: -.68,
|
|
215
|
-
w_in: 1,
|
|
216
|
-
w_out: 1
|
|
217
|
-
},
|
|
218
|
-
{
|
|
219
|
-
x: 1,
|
|
220
|
-
y: .82,
|
|
221
|
-
r_in: -1.32,
|
|
222
|
-
w_in: 1
|
|
223
|
-
}
|
|
224
|
-
]
|
|
225
|
-
},
|
|
226
|
-
naScreamer: {
|
|
227
|
-
samples: 80,
|
|
228
|
-
points: [
|
|
229
|
-
{
|
|
230
|
-
x: 0,
|
|
231
|
-
y: .56,
|
|
232
|
-
r_out: .58,
|
|
233
|
-
w_out: 1
|
|
234
|
-
},
|
|
235
|
-
{
|
|
236
|
-
x: .25,
|
|
237
|
-
y: .74,
|
|
238
|
-
r_in: .55,
|
|
239
|
-
r_out: .55,
|
|
240
|
-
w_in: 1,
|
|
241
|
-
w_out: 1
|
|
242
|
-
},
|
|
243
|
-
{
|
|
244
|
-
x: .45,
|
|
245
|
-
y: .84,
|
|
246
|
-
r_in: .62,
|
|
247
|
-
r_out: .62,
|
|
248
|
-
w_in: 1,
|
|
249
|
-
w_out: 1
|
|
250
|
-
},
|
|
251
|
-
{
|
|
252
|
-
x: .68,
|
|
253
|
-
y: 1,
|
|
254
|
-
r_in: 0,
|
|
255
|
-
r_out: 0,
|
|
256
|
-
w_in: 1,
|
|
257
|
-
w_out: 1
|
|
258
|
-
},
|
|
259
|
-
{
|
|
260
|
-
x: .93,
|
|
261
|
-
y: .915,
|
|
262
|
-
r_in: -.66,
|
|
263
|
-
r_out: -.66,
|
|
264
|
-
w_in: 1,
|
|
265
|
-
w_out: 1
|
|
266
|
-
},
|
|
267
|
-
{
|
|
268
|
-
x: 1,
|
|
269
|
-
y: .8,
|
|
270
|
-
r_in: -1.12,
|
|
271
|
-
w_in: 1
|
|
272
|
-
}
|
|
273
|
-
]
|
|
274
|
-
},
|
|
275
|
-
heavyTurboDiesel: {
|
|
276
|
-
samples: 80,
|
|
277
|
-
points: [
|
|
278
|
-
{
|
|
279
|
-
x: 0,
|
|
280
|
-
y: .64,
|
|
281
|
-
r_out: 1.05,
|
|
282
|
-
w_out: 1
|
|
283
|
-
},
|
|
284
|
-
{
|
|
285
|
-
x: .14,
|
|
286
|
-
y: .88,
|
|
287
|
-
r_in: .98,
|
|
288
|
-
r_out: .98,
|
|
289
|
-
w_in: 1,
|
|
290
|
-
w_out: 1
|
|
291
|
-
},
|
|
292
|
-
{
|
|
293
|
-
x: .28,
|
|
294
|
-
y: 1,
|
|
295
|
-
r_in: 0,
|
|
296
|
-
r_out: 0,
|
|
297
|
-
w_in: 1,
|
|
298
|
-
w_out: 1
|
|
299
|
-
},
|
|
300
|
-
{
|
|
301
|
-
x: .44,
|
|
302
|
-
y: .975,
|
|
303
|
-
r_in: -.32,
|
|
304
|
-
r_out: -.32,
|
|
305
|
-
w_in: 1,
|
|
306
|
-
w_out: 1
|
|
307
|
-
},
|
|
308
|
-
{
|
|
309
|
-
x: .72,
|
|
310
|
-
y: .73,
|
|
311
|
-
r_in: -.92,
|
|
312
|
-
r_out: -.92,
|
|
313
|
-
w_in: 1,
|
|
314
|
-
w_out: 1
|
|
315
|
-
},
|
|
316
|
-
{
|
|
317
|
-
x: 1,
|
|
318
|
-
y: .28,
|
|
319
|
-
r_in: -1.08,
|
|
320
|
-
w_in: 1
|
|
321
|
-
}
|
|
322
|
-
]
|
|
323
|
-
},
|
|
324
|
-
evDirectDrive: {
|
|
325
|
-
samples: 80,
|
|
326
|
-
points: [
|
|
327
|
-
{
|
|
328
|
-
x: 0,
|
|
329
|
-
y: 1,
|
|
330
|
-
r_out: 0,
|
|
331
|
-
w_out: 1
|
|
332
|
-
},
|
|
333
|
-
{
|
|
334
|
-
x: .32,
|
|
335
|
-
y: 1,
|
|
336
|
-
r_in: 0,
|
|
337
|
-
r_out: -1.2611,
|
|
338
|
-
w_in: 1,
|
|
339
|
-
w_out: 1
|
|
340
|
-
},
|
|
341
|
-
{
|
|
342
|
-
x: .44,
|
|
343
|
-
y: .7273,
|
|
344
|
-
r_in: -1.0267,
|
|
345
|
-
r_out: -1.0267,
|
|
346
|
-
w_in: 1,
|
|
347
|
-
w_out: 1
|
|
348
|
-
},
|
|
349
|
-
{
|
|
350
|
-
x: .6,
|
|
351
|
-
y: .5333,
|
|
352
|
-
r_in: -.7266,
|
|
353
|
-
r_out: -.7266,
|
|
354
|
-
w_in: 1,
|
|
355
|
-
w_out: 1
|
|
356
|
-
},
|
|
357
|
-
{
|
|
358
|
-
x: .78,
|
|
359
|
-
y: .4103,
|
|
360
|
-
r_in: -.4842,
|
|
361
|
-
r_out: -.4842,
|
|
362
|
-
w_in: 1,
|
|
363
|
-
w_out: 1
|
|
364
|
-
},
|
|
365
|
-
{
|
|
366
|
-
x: 1,
|
|
367
|
-
y: .32,
|
|
368
|
-
r_in: -.3097,
|
|
369
|
-
w_in: 1
|
|
370
|
-
}
|
|
371
|
-
]
|
|
372
|
-
}
|
|
373
|
-
};
|
|
374
|
-
var STEER_SPEED_CURVES = {
|
|
375
|
-
progressiveHighway: {
|
|
376
|
-
samples: 80,
|
|
377
|
-
points: [
|
|
378
|
-
{
|
|
379
|
-
x: 0,
|
|
380
|
-
y: 1,
|
|
381
|
-
r_out: 0,
|
|
382
|
-
w_out: 1
|
|
383
|
-
},
|
|
384
|
-
{
|
|
385
|
-
x: .2,
|
|
386
|
-
y: 1,
|
|
387
|
-
r_in: 0,
|
|
388
|
-
r_out: 0,
|
|
389
|
-
w_in: 1,
|
|
390
|
-
w_out: 1
|
|
391
|
-
},
|
|
392
|
-
{
|
|
393
|
-
x: .5,
|
|
394
|
-
y: .62,
|
|
395
|
-
r_in: -.82,
|
|
396
|
-
r_out: -.82,
|
|
397
|
-
w_in: 1,
|
|
398
|
-
w_out: 1
|
|
399
|
-
},
|
|
400
|
-
{
|
|
401
|
-
x: 1,
|
|
402
|
-
y: .3,
|
|
403
|
-
r_in: -.35,
|
|
404
|
-
w_in: 1
|
|
405
|
-
}
|
|
406
|
-
]
|
|
407
|
-
},
|
|
408
|
-
driftCountersteer: {
|
|
409
|
-
samples: 80,
|
|
410
|
-
points: [
|
|
411
|
-
{
|
|
412
|
-
x: 0,
|
|
413
|
-
y: 1,
|
|
414
|
-
r_out: 0,
|
|
415
|
-
w_out: 1
|
|
416
|
-
},
|
|
417
|
-
{
|
|
418
|
-
x: .14,
|
|
419
|
-
y: 1,
|
|
420
|
-
r_in: 0,
|
|
421
|
-
r_out: 0,
|
|
422
|
-
w_in: 1,
|
|
423
|
-
w_out: 1
|
|
424
|
-
},
|
|
425
|
-
{
|
|
426
|
-
x: .3,
|
|
427
|
-
y: .72,
|
|
428
|
-
r_in: -1.02,
|
|
429
|
-
r_out: -1.02,
|
|
430
|
-
w_in: 1,
|
|
431
|
-
w_out: 1
|
|
432
|
-
},
|
|
433
|
-
{
|
|
434
|
-
x: .5,
|
|
435
|
-
y: .48,
|
|
436
|
-
r_in: -.74,
|
|
437
|
-
r_out: -.74,
|
|
438
|
-
w_in: 1,
|
|
439
|
-
w_out: 1
|
|
440
|
-
},
|
|
441
|
-
{
|
|
442
|
-
x: .75,
|
|
443
|
-
y: .32,
|
|
444
|
-
r_in: -.44,
|
|
445
|
-
r_out: -.44,
|
|
446
|
-
w_in: 1,
|
|
447
|
-
w_out: 1
|
|
448
|
-
},
|
|
449
|
-
{
|
|
450
|
-
x: 1,
|
|
451
|
-
y: .24,
|
|
452
|
-
r_in: -.2,
|
|
453
|
-
w_in: 1
|
|
454
|
-
}
|
|
455
|
-
]
|
|
456
|
-
},
|
|
457
|
-
evSingleGearGt: {
|
|
458
|
-
samples: 80,
|
|
459
|
-
points: [
|
|
460
|
-
{
|
|
461
|
-
x: 0,
|
|
462
|
-
y: 1,
|
|
463
|
-
r_out: 0,
|
|
464
|
-
w_out: 1
|
|
465
|
-
},
|
|
466
|
-
{
|
|
467
|
-
x: .08,
|
|
468
|
-
y: 1,
|
|
469
|
-
r_in: 0,
|
|
470
|
-
r_out: 0,
|
|
471
|
-
w_in: 1,
|
|
472
|
-
w_out: 1
|
|
473
|
-
},
|
|
474
|
-
{
|
|
475
|
-
x: .2,
|
|
476
|
-
y: .28,
|
|
477
|
-
r_in: -1.1,
|
|
478
|
-
r_out: -1.1,
|
|
479
|
-
w_in: 1,
|
|
480
|
-
w_out: 1
|
|
481
|
-
},
|
|
482
|
-
{
|
|
483
|
-
x: .5,
|
|
484
|
-
y: .11,
|
|
485
|
-
r_in: -.25,
|
|
486
|
-
r_out: -.25,
|
|
487
|
-
w_in: 1,
|
|
488
|
-
w_out: 1
|
|
489
|
-
},
|
|
490
|
-
{
|
|
491
|
-
x: 1,
|
|
492
|
-
y: .07,
|
|
493
|
-
r_in: 0,
|
|
494
|
-
w_in: 1
|
|
495
|
-
}
|
|
496
|
-
]
|
|
497
|
-
},
|
|
498
|
-
heavy6x6AntiRollover: {
|
|
499
|
-
samples: 80,
|
|
500
|
-
points: [
|
|
501
|
-
{
|
|
502
|
-
x: 0,
|
|
503
|
-
y: 1,
|
|
504
|
-
r_out: 0,
|
|
505
|
-
w_out: 1
|
|
506
|
-
},
|
|
507
|
-
{
|
|
508
|
-
x: .1,
|
|
509
|
-
y: .94,
|
|
510
|
-
r_in: -.45,
|
|
511
|
-
r_out: -.95,
|
|
512
|
-
w_in: 1,
|
|
513
|
-
w_out: 1
|
|
514
|
-
},
|
|
515
|
-
{
|
|
516
|
-
x: .28,
|
|
517
|
-
y: .42,
|
|
518
|
-
r_in: -1.12,
|
|
519
|
-
r_out: -.85,
|
|
520
|
-
w_in: 1,
|
|
521
|
-
w_out: 1
|
|
522
|
-
},
|
|
523
|
-
{
|
|
524
|
-
x: .55,
|
|
525
|
-
y: .19,
|
|
526
|
-
r_in: -.42,
|
|
527
|
-
r_out: -.22,
|
|
528
|
-
w_in: 1,
|
|
529
|
-
w_out: 1
|
|
530
|
-
},
|
|
531
|
-
{
|
|
532
|
-
x: 1,
|
|
533
|
-
y: .11,
|
|
534
|
-
r_in: -.1,
|
|
535
|
-
w_in: 1
|
|
536
|
-
}
|
|
537
|
-
]
|
|
538
|
-
}
|
|
539
|
-
};
|
|
540
|
-
export { ENGINE_TORQUE_CURVES, STEER_SPEED_CURVES, TIRE_ARCHETYPES, TIRE_SLIP_CURVES, compilePacejkaCurve, engineHorsepowerForPeakTorque, tireGripForSurface };
|
|
541
|
-
|
|
542
|
-
//# sourceMappingURL=curves.js.map
|
package/dist/curves.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"curves.js","names":[],"sources":["../src/pacejka.ts","../src/curves.ts"],"sourcesContent":["export type CurvePoint = {\n x: number;\n y: number;\n r_in?: number;\n r_out?: number;\n w_in?: number;\n w_out?: number;\n};\n\nexport type CurveData = {\n points: CurvePoint[];\n samples?: number;\n};\n\nconst HALF_PI = Math.PI * 0.5;\nconst MIN_KNOT_SPACING = 0.01;\nconst MAX_TANGENT_SECANT_RATIO = 2.85;\nconst MAX_RAD = 1.54;\n\nfunction clamp(v: number, lo: number, hi: number): number {\n return v < lo ? lo : v > hi ? hi : v;\n}\n\nfunction uVal(x: number, axis: \"lng\" | \"lat\"): number {\n return axis === \"lat\" ? Math.sin(HALF_PI * x) : x;\n}\n\nfunction duVal(x: number, axis: \"lng\" | \"lat\"): number {\n return axis === \"lat\" ? HALF_PI * Math.cos(HALF_PI * x) : 1;\n}\n\nfunction pacejkaPhi(u: number, B: number, E: number): number {\n const bu = B * u;\n return bu - E * (bu - Math.atan(bu));\n}\n\nfunction pacejkaYRaw(u: number, B: number, C: number, E: number): number {\n return Math.sin(C * Math.atan(pacejkaPhi(u, B, E)));\n}\n\nfunction pacejkaSlopeX(x: number, B: number, C: number, E: number, axis: \"lng\" | \"lat\"): number {\n const u = uVal(x, axis);\n const bu = B * u;\n const phi = pacejkaPhi(u, B, E);\n const dphiDu = B * ((1 - E) + E / (1 + bu * bu));\n const dyDphi = (C * Math.cos(C * Math.atan(phi))) / (1 + phi * phi);\n return dyDphi * dphiDu * duVal(x, axis);\n}\n\n/**\n * Exact 8-knot Fritsch-Carlson monotone Pacejka Magic Formula compiler for `ecctrl/curves`.\n * - `\"lng\"`: `u = x` matching `ShapeCastWheel` `lngSlipRatio = |w*R - vx| / |vx|`.\n * - `\"lat\"`: `u = sin((pi/2) * x)` matching `ShapeCastWheel` `latSlipRatio = atan2(|vy|, |vx|) / (pi/2)`.\n */\nexport function compilePacejkaCurve(\n B: number,\n C: number,\n E: number,\n samples = 100,\n axis: \"lng\" | \"lat\" = \"lng\",\n): CurveData {\n let xPeak = 1;\n if (C > 1) {\n const targetPhi = Math.tan(Math.PI / (2 * C));\n if (pacejkaPhi(1, B, E) >= targetPhi) {\n let lo = 0;\n let hi = 1;\n for (let iter = 0; iter < 48; iter++) {\n const mid = 0.5 * (lo + hi);\n if (pacejkaPhi(uVal(mid, axis), B, E) >= targetPhi)\n hi = mid;\n else\n lo = mid;\n }\n xPeak = hi;\n }\n }\n\n const yPeakRaw = pacejkaYRaw(uVal(xPeak, axis), B, C, E);\n const invYMax = yPeakRaw > 1e-6 ? 1 / yPeakRaw : 1;\n\n const rawKnots = [\n 0,\n 0.32 * xPeak,\n 0.68 * xPeak,\n xPeak,\n xPeak + 0.06 * (1 - xPeak),\n xPeak + 0.18 * (1 - xPeak),\n xPeak + 0.48 * (1 - xPeak),\n 1,\n ];\n\n const knots: number[] = [0];\n for (let i = 1; i < rawKnots.length - 1; i++) {\n const k = rawKnots[i];\n if (k - knots[knots.length - 1] >= MIN_KNOT_SPACING && 1 - k >= MIN_KNOT_SPACING)\n knots.push(k);\n }\n knots.push(1);\n\n const ys = knots.map((x) => {\n if (x === xPeak && C > 1 && yPeakRaw > 1e-6 && pacejkaPhi(1, B, E) >= Math.tan(Math.PI / (2 * C)))\n return 1;\n return pacejkaYRaw(uVal(x, axis), B, C, E) * invYMax;\n });\n\n const secants: number[] = [];\n for (let i = 0; i < knots.length - 1; i++) {\n secants.push((ys[i + 1] - ys[i]) / (knots[i + 1] - knots[i]));\n }\n\n const slopes = knots.map((x, i) => {\n if (x === xPeak && x < 1)\n return 0;\n const mRaw = pacejkaSlopeX(x, B, C, E, axis) * invYMax;\n if (i === 0) {\n const s = secants[0];\n if (Math.abs(s) <= 1e-9)\n return 0;\n return clamp(mRaw / s, 0, MAX_TANGENT_SECANT_RATIO) * s;\n }\n if (i === knots.length - 1) {\n const s = secants[secants.length - 1];\n if (Math.abs(s) <= 1e-9)\n return 0;\n return clamp(mRaw / s, 0, MAX_TANGENT_SECANT_RATIO) * s;\n }\n const sL = secants[i - 1];\n const sR = secants[i];\n if (sL * sR <= 0 || Math.abs(sL) <= 1e-9 || Math.abs(sR) <= 1e-9)\n return 0;\n const minS = Math.abs(sL) <= Math.abs(sR) ? sL : sR;\n return clamp(mRaw / minS, 0, MAX_TANGENT_SECANT_RATIO) * minS;\n });\n\n const points: CurvePoint[] = knots.map((x, i) => {\n const ang = clamp(Math.atan(slopes[i]), -MAX_RAD, MAX_RAD);\n const pt: CurvePoint = {\n x: Number(x.toFixed(6)),\n y: Number(ys[i].toFixed(6)),\n };\n if (i > 0) {\n pt.r_in = Number(ang.toFixed(6));\n pt.w_in = 1;\n }\n if (i < knots.length - 1) {\n pt.r_out = Number(ang.toFixed(6));\n pt.w_out = 1;\n }\n return pt;\n });\n\n return { points, samples };\n}\n\n/** Inverts `ShapeCastWheel` `(rayHitFriction + tireGripFactor) * 0.5 = muPeak`. */\nexport function tireGripForSurface(muPeakLng: number, groundColliderFriction = 0.5): number {\n return Number((2 * muPeakLng - groundColliderFriction).toFixed(4));\n}\n\n/** Converts physical peak engine torque (N*m) into `carConfig.engineHorsepower` (`T * RPM / 7022`). */\nexport function engineHorsepowerForPeakTorque(peakTorqueNm: number, engineMaxRPM: number): number {\n return Number(((peakTorqueNm * engineMaxRPM) / 7022).toFixed(1));\n}\n","import {\n compilePacejkaCurve,\n engineHorsepowerForPeakTorque,\n tireGripForSurface,\n type CurveData,\n type CurvePoint,\n} from \"./pacejka.js\";\n\nexport type { CurveData, CurvePoint };\nexport { compilePacejkaCurve, engineHorsepowerForPeakTorque, tireGripForSurface };\n\nexport interface TireArchetypePreset {\n lng: CurveData;\n lat: CurveData;\n muPeakLng: number;\n latFrictionEllipseScale: number;\n relaxLngRate: number;\n relaxLatRate: number;\n}\n\nexport const TIRE_ARCHETYPES = {\n hypercarDry: {\n lng: compilePacejkaCurve(11.2, 1.54, -0.45, 100, \"lng\"),\n lat: compilePacejkaCurve(11.6, 1.5, -0.4, 100, \"lat\"),\n muPeakLng: 1.38 as const,\n latFrictionEllipseScale: 0.97 as const,\n relaxLngRate: 0.04 as const,\n relaxLatRate: 0.06 as const,\n },\n streetDrift90s: {\n lng: compilePacejkaCurve(8.8, 1.5, -0.15, 80, \"lng\"),\n lat: compilePacejkaCurve(9.2, 1.44, -0.12, 80, \"lat\"),\n muPeakLng: 1.08 as const,\n latFrictionEllipseScale: 0.97 as const,\n relaxLngRate: 0.05 as const,\n relaxLatRate: 0.1 as const,\n },\n offroad6x6At: {\n lng: compilePacejkaCurve(6.2, 1.48, -0.35, 80, \"lng\"),\n lat: compilePacejkaCurve(6.6, 1.48, -0.3, 80, \"lat\"),\n muPeakLng: 0.85 as const,\n latFrictionEllipseScale: 0.87 as const,\n relaxLngRate: 0.12 as const,\n relaxLatRate: 0.24 as const,\n },\n gravelRally: {\n lng: compilePacejkaCurve(5.8, 1.26, -0.45, 80, \"lng\"),\n lat: compilePacejkaCurve(6.4, 1.28, -0.4, 80, \"lat\"),\n muPeakLng: 0.74 as const,\n latFrictionEllipseScale: 0.92 as const,\n relaxLngRate: 0.08 as const,\n relaxLatRate: 0.16 as const,\n },\n wetAsphalt: {\n lng: compilePacejkaCurve(12.8, 1.66, -0.6, 100, \"lng\"),\n lat: compilePacejkaCurve(12.2, 1.62, -0.55, 100, \"lat\"),\n muPeakLng: 0.8 as const,\n latFrictionEllipseScale: 0.95 as const,\n relaxLngRate: 0.05 as const,\n relaxLatRate: 0.09 as const,\n },\n snowIce: {\n lng: compilePacejkaCurve(17.5, 1.64, -1.15, 120, \"lng\"),\n lat: compilePacejkaCurve(16.5, 1.61, -1.05, 120, \"lat\"),\n muPeakLng: 0.28 as const,\n latFrictionEllipseScale: 0.93 as const,\n relaxLngRate: 0.06 as const,\n relaxLatRate: 0.12 as const,\n },\n} as const;\n\nexport const TIRE_SLIP_CURVES: {\n readonly streetRadial: CurveData;\n readonly driftProgressive: CurveData;\n readonly offroadLug: CurveData;\n} = {\n streetRadial: TIRE_ARCHETYPES.streetDrift90s.lng,\n driftProgressive: TIRE_ARCHETYPES.streetDrift90s.lat,\n offroadLug: TIRE_ARCHETYPES.offroad6x6At.lng,\n};\n\nexport const ENGINE_TORQUE_CURVES = {\n w16QuadTurbo: {\n samples: 80 as const,\n points: [\n { x: 0 as const, y: 0.62 as const, r_out: 0.85 as const, w_out: 1 as const },\n { x: 0.15 as const, y: 0.84 as const, r_in: 1.05 as const, r_out: 1.05 as const, w_in: 1 as const, w_out: 1 as const },\n { x: 0.27 as const, y: 1 as const, r_in: 0 as const, r_out: 0 as const, w_in: 1 as const, w_out: 1 as const },\n { x: 0.84 as const, y: 1 as const, r_in: 0 as const, r_out: 0 as const, w_in: 1 as const, w_out: 1 as const },\n { x: 0.95 as const, y: 0.962 as const, r_in: -0.68 as const, r_out: -0.68 as const, w_in: 1 as const, w_out: 1 as const },\n { x: 1 as const, y: 0.82 as const, r_in: -1.32 as const, w_in: 1 as const },\n ] as [\n { readonly x: 0; readonly y: 0.62; readonly r_out: 0.85; readonly w_out: 1 },\n { readonly x: 0.15; readonly y: 0.84; readonly r_in: 1.05; readonly r_out: 1.05; readonly w_in: 1; readonly w_out: 1 },\n { readonly x: 0.27; readonly y: 1; readonly r_in: 0; readonly r_out: 0; readonly w_in: 1; readonly w_out: 1 },\n { readonly x: 0.84; readonly y: 1; readonly r_in: 0; readonly r_out: 0; readonly w_in: 1; readonly w_out: 1 },\n { readonly x: 0.95; readonly y: 0.962; readonly r_in: -0.68; readonly r_out: -0.68; readonly w_in: 1; readonly w_out: 1 },\n { readonly x: 1; readonly y: 0.82; readonly r_in: -1.32; readonly w_in: 1 }\n ],\n },\n naScreamer: {\n samples: 80 as const,\n points: [\n { x: 0 as const, y: 0.56 as const, r_out: 0.58 as const, w_out: 1 as const },\n { x: 0.25 as const, y: 0.74 as const, r_in: 0.55 as const, r_out: 0.55 as const, w_in: 1 as const, w_out: 1 as const },\n { x: 0.45 as const, y: 0.84 as const, r_in: 0.62 as const, r_out: 0.62 as const, w_in: 1 as const, w_out: 1 as const },\n { x: 0.68 as const, y: 1 as const, r_in: 0 as const, r_out: 0 as const, w_in: 1 as const, w_out: 1 as const },\n { x: 0.93 as const, y: 0.915 as const, r_in: -0.66 as const, r_out: -0.66 as const, w_in: 1 as const, w_out: 1 as const },\n { x: 1 as const, y: 0.8 as const, r_in: -1.12 as const, w_in: 1 as const },\n ] as [\n { readonly x: 0; readonly y: 0.56; readonly r_out: 0.58; readonly w_out: 1 },\n { readonly x: 0.25; readonly y: 0.74; readonly r_in: 0.55; readonly r_out: 0.55; readonly w_in: 1; readonly w_out: 1 },\n { readonly x: 0.45; readonly y: 0.84; readonly r_in: 0.62; readonly r_out: 0.62; readonly w_in: 1; readonly w_out: 1 },\n { readonly x: 0.68; readonly y: 1; readonly r_in: 0; readonly r_out: 0; readonly w_in: 1; readonly w_out: 1 },\n { readonly x: 0.93; readonly y: 0.915; readonly r_in: -0.66; readonly r_out: -0.66; readonly w_in: 1; readonly w_out: 1 },\n { readonly x: 1; readonly y: 0.8; readonly r_in: -1.12; readonly w_in: 1 }\n ],\n },\n heavyTurboDiesel: {\n samples: 80 as const,\n points: [\n { x: 0 as const, y: 0.64 as const, r_out: 1.05 as const, w_out: 1 as const },\n { x: 0.14 as const, y: 0.88 as const, r_in: 0.98 as const, r_out: 0.98 as const, w_in: 1 as const, w_out: 1 as const },\n { x: 0.28 as const, y: 1 as const, r_in: 0 as const, r_out: 0 as const, w_in: 1 as const, w_out: 1 as const },\n { x: 0.44 as const, y: 0.975 as const, r_in: -0.32 as const, r_out: -0.32 as const, w_in: 1 as const, w_out: 1 as const },\n { x: 0.72 as const, y: 0.73 as const, r_in: -0.92 as const, r_out: -0.92 as const, w_in: 1 as const, w_out: 1 as const },\n { x: 1 as const, y: 0.28 as const, r_in: -1.08 as const, w_in: 1 as const },\n ] as [\n { readonly x: 0; readonly y: 0.64; readonly r_out: 1.05; readonly w_out: 1 },\n { readonly x: 0.14; readonly y: 0.88; readonly r_in: 0.98; readonly r_out: 0.98; readonly w_in: 1; readonly w_out: 1 },\n { readonly x: 0.28; readonly y: 1; readonly r_in: 0; readonly r_out: 0; readonly w_in: 1; readonly w_out: 1 },\n { readonly x: 0.44; readonly y: 0.975; readonly r_in: -0.32; readonly r_out: -0.32; readonly w_in: 1; readonly w_out: 1 },\n { readonly x: 0.72; readonly y: 0.73; readonly r_in: -0.92; readonly r_out: -0.92; readonly w_in: 1; readonly w_out: 1 },\n { readonly x: 1; readonly y: 0.28; readonly r_in: -1.08; readonly w_in: 1 }\n ],\n },\n evDirectDrive: {\n samples: 80 as const,\n points: [\n { x: 0 as const, y: 1 as const, r_out: 0 as const, w_out: 1 as const },\n { x: 0.32 as const, y: 1 as const, r_in: 0 as const, r_out: -1.2611 as const, w_in: 1 as const, w_out: 1 as const },\n { x: 0.44 as const, y: 0.7273 as const, r_in: -1.0267 as const, r_out: -1.0267 as const, w_in: 1 as const, w_out: 1 as const },\n { x: 0.6 as const, y: 0.5333 as const, r_in: -0.7266 as const, r_out: -0.7266 as const, w_in: 1 as const, w_out: 1 as const },\n { x: 0.78 as const, y: 0.4103 as const, r_in: -0.4842 as const, r_out: -0.4842 as const, w_in: 1 as const, w_out: 1 as const },\n { x: 1 as const, y: 0.32 as const, r_in: -0.3097 as const, w_in: 1 as const },\n ] as [\n { readonly x: 0; readonly y: 1; readonly r_out: 0; readonly w_out: 1 },\n { readonly x: 0.32; readonly y: 1; readonly r_in: 0; readonly r_out: -1.2611; readonly w_in: 1; readonly w_out: 1 },\n { readonly x: 0.44; readonly y: 0.7273; readonly r_in: -1.0267; readonly r_out: -1.0267; readonly w_in: 1; readonly w_out: 1 },\n { readonly x: 0.6; readonly y: 0.5333; readonly r_in: -0.7266; readonly r_out: -0.7266; readonly w_in: 1; readonly w_out: 1 },\n { readonly x: 0.78; readonly y: 0.4103; readonly r_in: -0.4842; readonly r_out: -0.4842; readonly w_in: 1; readonly w_out: 1 },\n { readonly x: 1; readonly y: 0.32; readonly r_in: -0.3097; readonly w_in: 1 }\n ],\n },\n} as const;\n\nexport const STEER_SPEED_CURVES = {\n progressiveHighway: {\n samples: 80 as const,\n points: [\n { x: 0 as const, y: 1 as const, r_out: 0 as const, w_out: 1 as const },\n { x: 0.2 as const, y: 1 as const, r_in: 0 as const, r_out: 0 as const, w_in: 1 as const, w_out: 1 as const },\n { x: 0.5 as const, y: 0.62 as const, r_in: -0.82 as const, r_out: -0.82 as const, w_in: 1 as const, w_out: 1 as const },\n { x: 1 as const, y: 0.3 as const, r_in: -0.35 as const, w_in: 1 as const },\n ] as [\n { readonly x: 0; readonly y: 1; readonly r_out: 0; readonly w_out: 1 },\n { readonly x: 0.2; readonly y: 1; readonly r_in: 0; readonly r_out: 0; readonly w_in: 1; readonly w_out: 1 },\n { readonly x: 0.5; readonly y: 0.62; readonly r_in: -0.82; readonly r_out: -0.82; readonly w_in: 1; readonly w_out: 1 },\n { readonly x: 1; readonly y: 0.3; readonly r_in: -0.35; readonly w_in: 1 }\n ],\n },\n driftCountersteer: {\n samples: 80 as const,\n points: [\n { x: 0 as const, y: 1 as const, r_out: 0 as const, w_out: 1 as const },\n { x: 0.14 as const, y: 1 as const, r_in: 0 as const, r_out: 0 as const, w_in: 1 as const, w_out: 1 as const },\n { x: 0.3 as const, y: 0.72 as const, r_in: -1.02 as const, r_out: -1.02 as const, w_in: 1 as const, w_out: 1 as const },\n { x: 0.5 as const, y: 0.48 as const, r_in: -0.74 as const, r_out: -0.74 as const, w_in: 1 as const, w_out: 1 as const },\n { x: 0.75 as const, y: 0.32 as const, r_in: -0.44 as const, r_out: -0.44 as const, w_in: 1 as const, w_out: 1 as const },\n { x: 1 as const, y: 0.24 as const, r_in: -0.2 as const, w_in: 1 as const },\n ] as [\n { readonly x: 0; readonly y: 1; readonly r_out: 0; readonly w_out: 1 },\n { readonly x: 0.14; readonly y: 1; readonly r_in: 0; readonly r_out: 0; readonly w_in: 1; readonly w_out: 1 },\n { readonly x: 0.3; readonly y: 0.72; readonly r_in: -1.02; readonly r_out: -1.02; readonly w_in: 1; readonly w_out: 1 },\n { readonly x: 0.5; readonly y: 0.48; readonly r_in: -0.74; readonly r_out: -0.74; readonly w_in: 1; readonly w_out: 1 },\n { readonly x: 0.75; readonly y: 0.32; readonly r_in: -0.44; readonly r_out: -0.44; readonly w_in: 1; readonly w_out: 1 },\n { readonly x: 1; readonly y: 0.24; readonly r_in: -0.2; readonly w_in: 1 }\n ],\n },\n evSingleGearGt: {\n samples: 80 as const,\n points: [\n { x: 0 as const, y: 1 as const, r_out: 0 as const, w_out: 1 as const },\n { x: 0.08 as const, y: 1 as const, r_in: 0 as const, r_out: 0 as const, w_in: 1 as const, w_out: 1 as const },\n { x: 0.2 as const, y: 0.28 as const, r_in: -1.1 as const, r_out: -1.1 as const, w_in: 1 as const, w_out: 1 as const },\n { x: 0.5 as const, y: 0.11 as const, r_in: -0.25 as const, r_out: -0.25 as const, w_in: 1 as const, w_out: 1 as const },\n { x: 1 as const, y: 0.07 as const, r_in: 0 as const, w_in: 1 as const },\n ] as [\n { readonly x: 0; readonly y: 1; readonly r_out: 0; readonly w_out: 1 },\n { readonly x: 0.08; readonly y: 1; readonly r_in: 0; readonly r_out: 0; readonly w_in: 1; readonly w_out: 1 },\n { readonly x: 0.2; readonly y: 0.28; readonly r_in: -1.1; readonly r_out: -1.1; readonly w_in: 1; readonly w_out: 1 },\n { readonly x: 0.5; readonly y: 0.11; readonly r_in: -0.25; readonly r_out: -0.25; readonly w_in: 1; readonly w_out: 1 },\n { readonly x: 1; readonly y: 0.07; readonly r_in: 0; readonly w_in: 1 }\n ],\n },\n heavy6x6AntiRollover: {\n samples: 80 as const,\n points: [\n { x: 0 as const, y: 1 as const, r_out: 0 as const, w_out: 1 as const },\n { x: 0.1 as const, y: 0.94 as const, r_in: -0.45 as const, r_out: -0.95 as const, w_in: 1 as const, w_out: 1 as const },\n { x: 0.28 as const, y: 0.42 as const, r_in: -1.12 as const, r_out: -0.85 as const, w_in: 1 as const, w_out: 1 as const },\n { x: 0.55 as const, y: 0.19 as const, r_in: -0.42 as const, r_out: -0.22 as const, w_in: 1 as const, w_out: 1 as const },\n { x: 1 as const, y: 0.11 as const, r_in: -0.1 as const, w_in: 1 as const },\n ] as [\n { readonly x: 0; readonly y: 1; readonly r_out: 0; readonly w_out: 1 },\n { readonly x: 0.1; readonly y: 0.94; readonly r_in: -0.45; readonly r_out: -0.95; readonly w_in: 1; readonly w_out: 1 },\n { readonly x: 0.28; readonly y: 0.42; readonly r_in: -1.12; readonly r_out: -0.85; readonly w_in: 1; readonly w_out: 1 },\n { readonly x: 0.55; readonly y: 0.19; readonly r_in: -0.42; readonly r_out: -0.22; readonly w_in: 1; readonly w_out: 1 },\n { readonly x: 1; readonly y: 0.11; readonly r_in: -0.1; readonly w_in: 1 }\n ],\n },\n} as const;\n"],"mappings":";AAcA,IAAM,UAAU,KAAK,KAAK;AAC1B,IAAM,mBAAmB;AACzB,IAAM,2BAA2B;AACjC,IAAM,UAAU;AAEhB,SAAS,MAAM,GAAW,IAAY,IAAoB;CACtD,OAAO,IAAI,KAAK,KAAK,IAAI,KAAK,KAAK;AACvC;AAEA,SAAS,KAAK,GAAW,MAA6B;CAClD,OAAO,SAAS,QAAQ,KAAK,IAAI,UAAU,CAAC,IAAI;AACpD;AAEA,SAAS,MAAM,GAAW,MAA6B;CACnD,OAAO,SAAS,QAAQ,UAAU,KAAK,IAAI,UAAU,CAAC,IAAI;AAC9D;AAEA,SAAS,WAAW,GAAW,GAAW,GAAmB;CACzD,MAAM,KAAK,IAAI;CACf,OAAO,KAAK,KAAK,KAAK,KAAK,KAAK,EAAE;AACtC;AAEA,SAAS,YAAY,GAAW,GAAW,GAAW,GAAmB;CACrE,OAAO,KAAK,IAAI,IAAI,KAAK,KAAK,WAAW,GAAG,GAAG,CAAC,CAAC,CAAC;AACtD;AAEA,SAAS,cAAc,GAAW,GAAW,GAAW,GAAW,MAA6B;CAC5F,MAAM,IAAI,KAAK,GAAG,IAAI;CACtB,MAAM,KAAK,IAAI;CACf,MAAM,MAAM,WAAW,GAAG,GAAG,CAAC;CAC9B,MAAM,SAAS,KAAM,IAAI,I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O;GAAW;GACtH;IAAE,GAAG;IAAY,GAAG;IAAe,MAAM;IAAY,MAAM;GAAW;EAC1E;CAOJ;CACA,sBAAsB;EAClB,SAAS;EACT,QAAQ;GACJ;IAAE,GAAG;IAAY,GAAG;IAAY,OAAO;IAAY,OAAO;GAAW;GACrE;IAAE,GAAG;IAAc,GAAG;IAAe,MAAM;IAAgB,OAAO;IAAgB,MAAM;IAAY,OAAO;GAAW;GACtH;IAAE,GAAG;IAAe,GAAG;IAAe,MAAM;IAAgB,OAAO;IAAgB,MAAM;IAAY,OAAO;GAAW;GACvH;IAAE,GAAG;IAAe,GAAG;IAAe,MAAM;IAAgB,OAAO;IAAgB,MAAM;IAAY,OAAO;GAAW;GACvH;IAAE,GAAG;IAAY,GAAG;IAAe,MAAM;IAAe,MAAM;GAAW;EAC7E;CAOJ;AACJ"}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import type * as THREE from "three";
|
|
2
|
-
import type { RawGltfJson } from "./khrGlb.js";
|
|
3
|
-
import { type KhrBodySpec, type KhrCarConfig, type KhrDroneConfig, type KhrImplicitShape } from "./khrTypes.js";
|
|
4
|
-
type RawNode = NonNullable<RawGltfJson["nodes"]>[number];
|
|
5
|
-
export declare function findOwnerBodyIdx(idx: number, parentIdx: Int32Array, rawNodes: readonly RawNode[]): number;
|
|
6
|
-
export declare function resolveConnectedBodyIdx(cIdx: number, parentIdx: Int32Array, rawNodes: readonly RawNode[]): number;
|
|
7
|
-
export declare function isInsideRotor(idx: number, parentIdx: Int32Array, rawNodes: readonly RawNode[]): boolean;
|
|
8
|
-
export declare function attachBodyColliders(rawNodes: readonly RawNode[], parentIdx: Int32Array, nodeNames: readonly string[], resolveObj: (idx: number) => THREE.Object3D | undefined, bodyByIdx: ReadonlyMap<number, KhrBodySpec>, shapes: readonly KhrImplicitShape[], materials: Array<Record<string, unknown>>, collisionGroups: readonly number[]): void;
|
|
9
|
-
export declare function computeMissingBodyInertias(bodyByIdx: ReadonlyMap<number, KhrBodySpec>, explicitInertiaSet: ReadonlySet<number>): void;
|
|
10
|
-
export declare function extractSceneExtras(json: RawGltfJson, sockets: Record<string, [number, number, number]>): {
|
|
11
|
-
ikSockets: Array<[string, [number, number, number]]>;
|
|
12
|
-
tune?: Partial<KhrCarConfig>;
|
|
13
|
-
droneTune?: Partial<KhrDroneConfig>;
|
|
14
|
-
};
|
|
15
|
-
export {};
|
package/dist/khrClone.d.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { type KhrAssetBundle } from "./khrTypes.js";
|
|
2
|
-
export declare function registerMountedSubtree(restoreForClone: () => () => void): () => void;
|
|
3
|
-
export declare function claimBundleMount(bundle: KhrAssetBundle, ownerComponent: string): void;
|
|
4
|
-
export declare function releaseBundleMount(bundle: KhrAssetBundle): void;
|
|
5
|
-
/**
|
|
6
|
-
* Clones a parsed `KhrAssetBundle` in O(nodes) while sharing parsed `.glb` buffers,
|
|
7
|
-
* GPU `BufferGeometry` / `Material` buffers, and Rapier `Float32Array` collider vertices.
|
|
8
|
-
*/
|
|
9
|
-
export declare function cloneKhrBundle(bundle: KhrAssetBundle): KhrAssetBundle;
|
|
10
|
-
/**
|
|
11
|
-
* Releases clone mount ownership while keeping shared template GPU resources intact.
|
|
12
|
-
* When called on a root template bundle, disposes unique GPU geometries, materials, and textures once.
|
|
13
|
-
*/
|
|
14
|
-
export declare function disposeKhrBundle(bundle: KhrAssetBundle): void;
|
package/dist/khrConfigTypes.d.ts
DELETED
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
import type { GLTFLoader } from "three/examples/jsm/loaders/GLTFLoader.js";
|
|
2
|
-
export declare class KhrValidationError extends Error {
|
|
3
|
-
constructor(message: string);
|
|
4
|
-
}
|
|
5
|
-
export interface KhrCurvePoint {
|
|
6
|
-
x: number;
|
|
7
|
-
y: number;
|
|
8
|
-
r_in?: number;
|
|
9
|
-
r_out?: number;
|
|
10
|
-
w_in?: number;
|
|
11
|
-
w_out?: number;
|
|
12
|
-
}
|
|
13
|
-
export interface KhrCurveData {
|
|
14
|
-
points: KhrCurvePoint[];
|
|
15
|
-
samples?: number;
|
|
16
|
-
}
|
|
17
|
-
export interface KhrCarConfig {
|
|
18
|
-
controlMode?: "VELOCITY" | "POSITION";
|
|
19
|
-
engineHorsepower?: number;
|
|
20
|
-
engineMaxRPM?: number;
|
|
21
|
-
gearRatios?: number[];
|
|
22
|
-
finalDriveRatio?: number;
|
|
23
|
-
transmissionMode?: "auto" | "manual";
|
|
24
|
-
shiftUpRPM?: number;
|
|
25
|
-
shiftDownRPM?: number;
|
|
26
|
-
shiftCooldown?: number;
|
|
27
|
-
steerRate?: number;
|
|
28
|
-
maxSteerAngle?: number;
|
|
29
|
-
reverseTorqueScale?: number;
|
|
30
|
-
reverseRPMScale?: number;
|
|
31
|
-
engineTorqueCurveData?: KhrCurveData;
|
|
32
|
-
steerAngleCurveData?: KhrCurveData;
|
|
33
|
-
}
|
|
34
|
-
export interface KhrDroneConfig {
|
|
35
|
-
controlMode?: "VELOCITY" | "POSITION";
|
|
36
|
-
maxYawRate?: number;
|
|
37
|
-
maxHorizSpeed?: number;
|
|
38
|
-
maxVertSpeed?: number;
|
|
39
|
-
maxTiltAngle?: number;
|
|
40
|
-
airDragFactor?: number;
|
|
41
|
-
TILT_P?: number;
|
|
42
|
-
TILT_D?: number;
|
|
43
|
-
YAW_POS_P?: number;
|
|
44
|
-
YAW_VEL_P?: number;
|
|
45
|
-
VERT_POS_P?: number;
|
|
46
|
-
VERT_POS_D?: number;
|
|
47
|
-
HORIZ_POS_P?: number;
|
|
48
|
-
HORIZ_POS_D?: number;
|
|
49
|
-
HORIZ_VEL_P?: number;
|
|
50
|
-
VERT_VEL_P?: number;
|
|
51
|
-
}
|
|
52
|
-
export interface KhrPluginOptions {
|
|
53
|
-
extractRole?: (nodeName: string, extras: Record<string, unknown>) => string | null;
|
|
54
|
-
isSocketNode?: (nodeName: string, extras: Record<string, unknown>) => boolean | string;
|
|
55
|
-
}
|
|
56
|
-
export interface LoadKhrGlbOptions extends KhrPluginOptions {
|
|
57
|
-
loader?: GLTFLoader;
|
|
58
|
-
}
|
|
59
|
-
export interface UseKhrGlbOptions extends KhrPluginOptions {
|
|
60
|
-
extendLoader?: (loader: GLTFLoader) => void;
|
|
61
|
-
cacheKey?: string;
|
|
62
|
-
}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { type KhrExportNodeSpec, type KhrImplicitShape, type OmiVehicleWheelSpec } from "./khrTypes.js";
|
|
2
|
-
export declare function optFinite(v: unknown, label: string, nonNeg?: boolean): number | undefined;
|
|
3
|
-
export declare function encodeShape(shape: KhrImplicitShape, nodeName: string): Record<string, unknown>;
|
|
4
|
-
export declare function encodeJoint(j: NonNullable<KhrExportNodeSpec["joint"]>, nodeName: string): Record<string, unknown>;
|
|
5
|
-
export declare function encodeMotion(m: NonNullable<KhrExportNodeSpec["motion"]>, nodeName: string): Record<string, unknown>;
|
|
6
|
-
export declare function encodePhysicsMaterial(col: NonNullable<KhrExportNodeSpec["collider"]>, nodeName: string): Record<string, unknown> | null;
|
|
7
|
-
export declare function encodeCollisionFilter(col: NonNullable<KhrExportNodeSpec["collider"]>, nodeName: string): Record<string, unknown> | null;
|
|
8
|
-
export declare function encodeOmiWheel(wheel: OmiVehicleWheelSpec, nodeName: string): Record<string, unknown>;
|