@adatechnology/game-weapons-three 0.25.0 → 0.26.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 +3 -2
- package/dist/{chunk-DCMD54HC.js → chunk-CGGF5CDD.js} +27 -2
- package/dist/{chunk-DCMD54HC.js.map → chunk-CGGF5CDD.js.map} +1 -1
- package/dist/index.d.ts +7 -2
- package/dist/index.global.js +29 -3
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/dist/testing.js +1 -1
- package/package.json +7 -7
package/README.md
CHANGED
|
@@ -66,5 +66,6 @@ The global `registerWeaponItemModel` and the rest are deprecated delegates of `d
|
|
|
66
66
|
## Loose pieces in the physics engine (spec 008, T4.3)
|
|
67
67
|
|
|
68
68
|
`createWeaponFx({ physics })` takes a `SeamWorld` of `@adatechnology/game-physics`: the casings that the gallery's models eject become bodies of it (`casingCollider`: a cylinder along x, C_rr 0.015,
|
|
69
|
-
swept), roll, sleep and bounce by the world's floor; the host's loop steps the world. Without it they keep the gallery's own bounce. `
|
|
70
|
-
|
|
69
|
+
swept), roll, sleep and bounce by the world's floor; the host's loop steps the world. Without it they keep the gallery's own bounce. `explosiveCollider(THREE, 'm67')` is the grenade as drawn
|
|
70
|
+
(body, fuze and spoon, read from `M67_PARTS`, the numbers the drawing uses) with C_rr 0.015 and no artificial damping; `spawnLoose`, `syncLoose`
|
|
71
|
+
and `dropLoose` put a loose piece in the world, copy its pose onto a mesh (reporting a bounce and sleep) and take it out. Measured on the kit's floor (`KIT_WORLD`): 48 seeded throws rest in 4.03-5.95 s and within 7.39 m of where they land (the owner's limit for the drawn grenade is 6.5 s and 8 m: it rocks on its fuze); 200 of 200 casings asleep 5 s after the last, none under the floor.
|
|
@@ -11518,11 +11518,13 @@ function pooledFlame(kit, pools, index) {
|
|
|
11518
11518
|
var LOOSE_ROLLING_RESISTANCE = 0.015;
|
|
11519
11519
|
var CASING_FILL = 0.25;
|
|
11520
11520
|
var BRASS_DENSITY = 8500;
|
|
11521
|
-
var
|
|
11521
|
+
var GRENADE_MASS_KG = 0.4;
|
|
11522
|
+
var LOOSE_USER = { casing: 100, grenade: 2 };
|
|
11522
11523
|
var BOUNCE_FALL_SPEED = 0.5;
|
|
11523
11524
|
var BOUNCE_RISE_SPEED = 0.2;
|
|
11524
11525
|
var QUARTER_TURN_Z = [0, 0, Math.SQRT1_2, Math.SQRT1_2];
|
|
11525
11526
|
var CASING_MATERIAL = { frictionStatic: 0.4, frictionDynamic: 0.3, restitution: 0.4 };
|
|
11527
|
+
var GRENADE_MATERIAL = { frictionStatic: 0.6, frictionDynamic: 0.5, restitution: 0.35 };
|
|
11526
11528
|
function casingCollider(radius, length) {
|
|
11527
11529
|
return {
|
|
11528
11530
|
shape: { kind: "compound", children: [{ shape: { kind: "cylinder", halfHeight: length / 2, radius }, position: [0, 0, 0], rotation: QUARTER_TURN_Z }] },
|
|
@@ -11532,6 +11534,28 @@ function casingCollider(radius, length) {
|
|
|
11532
11534
|
user: LOOSE_USER.casing
|
|
11533
11535
|
};
|
|
11534
11536
|
}
|
|
11537
|
+
function explosiveCollider(THREE, explosive) {
|
|
11538
|
+
if (explosive !== "m67") return void 0;
|
|
11539
|
+
const model = buildExplosiveModel(THREE, explosive);
|
|
11540
|
+
if (!model) return void 0;
|
|
11541
|
+
const centre = new THREE.Box3().setFromObject(model).getCenter(new THREE.Vector3());
|
|
11542
|
+
const { bodyRadius, fuze, spoon } = M67_PARTS;
|
|
11543
|
+
const at2 = (x, y) => [x - centre.x, y + bodyRadius - centre.y, 0 - centre.z];
|
|
11544
|
+
return {
|
|
11545
|
+
shape: {
|
|
11546
|
+
kind: "compound",
|
|
11547
|
+
children: [
|
|
11548
|
+
{ shape: { kind: "sphere", radius: bodyRadius }, position: at2(0, 0) },
|
|
11549
|
+
{ shape: { kind: "cylinder", halfHeight: fuze.height / 2, radius: fuze.radius }, position: at2(0, fuze.y) },
|
|
11550
|
+
{ shape: { kind: "box", half: [spoon.size[0] / 2, spoon.size[1] / 2, spoon.size[2] / 2] }, position: at2(spoon.x, spoon.y), rotation: [0, 0, Math.sin(spoon.tilt / 2), Math.cos(spoon.tilt / 2)] }
|
|
11551
|
+
]
|
|
11552
|
+
},
|
|
11553
|
+
mass: GRENADE_MASS_KG,
|
|
11554
|
+
material: GRENADE_MATERIAL,
|
|
11555
|
+
rolling: { coefficient: LOOSE_ROLLING_RESISTANCE, radius: bodyRadius },
|
|
11556
|
+
user: LOOSE_USER.grenade
|
|
11557
|
+
};
|
|
11558
|
+
}
|
|
11535
11559
|
function spawnLoose(world, collider, launch) {
|
|
11536
11560
|
const desc = {
|
|
11537
11561
|
shape: collider.shape,
|
|
@@ -15976,6 +16000,7 @@ export {
|
|
|
15976
16000
|
buildRound,
|
|
15977
16001
|
LOOSE_ROLLING_RESISTANCE,
|
|
15978
16002
|
casingCollider,
|
|
16003
|
+
explosiveCollider,
|
|
15979
16004
|
spawnLoose,
|
|
15980
16005
|
syncLoose,
|
|
15981
16006
|
dropLoose,
|
|
@@ -16015,4 +16040,4 @@ export {
|
|
|
16015
16040
|
DEFAULT_EXPLOSIVES_SCENE,
|
|
16016
16041
|
createExplosivesTestModule
|
|
16017
16042
|
};
|
|
16018
|
-
//# sourceMappingURL=chunk-
|
|
16043
|
+
//# sourceMappingURL=chunk-CGGF5CDD.js.map
|