@adatechnology/game-weapons-three 0.28.0 → 0.29.1
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/{chunk-IU5JELUL.js → chunk-5IW5LQG6.js} +55 -12
- package/dist/chunk-5IW5LQG6.js.map +1 -0
- package/dist/index.d.ts +6 -2
- package/dist/index.global.js +259 -34
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/testing.js +1 -1
- package/package.json +10 -10
- package/dist/chunk-IU5JELUL.js.map +0 -1
|
@@ -9591,20 +9591,33 @@ var SHOVEL_SWING = {
|
|
|
9591
9591
|
]
|
|
9592
9592
|
};
|
|
9593
9593
|
var KNIFE_SLASH = {
|
|
9594
|
+
pivot: "grip",
|
|
9594
9595
|
keys: [
|
|
9595
9596
|
{ at: 0, ...HOLD },
|
|
9596
|
-
{ at: 0.
|
|
9597
|
-
{ at: 0.43, offset: [-0.
|
|
9598
|
-
{ at: 0.62, offset: [-0.
|
|
9597
|
+
{ at: 0.28, offset: [0.07, 0.2, 0.05], turn: [0.5, -0.9, 0] },
|
|
9598
|
+
{ at: 0.43, offset: [-0.14, 0.06, -0.07], turn: [0.1, 0.9, 0] },
|
|
9599
|
+
{ at: 0.62, offset: [-0.2, -0.08, 0], turn: [-0.2, 1.3, 0] },
|
|
9599
9600
|
{ at: 1, ...HOLD }
|
|
9600
9601
|
]
|
|
9601
9602
|
};
|
|
9602
9603
|
var KNIFE_STAB = {
|
|
9604
|
+
pivot: "grip",
|
|
9603
9605
|
keys: [
|
|
9604
9606
|
{ at: 0, ...HOLD },
|
|
9605
|
-
{ at: 0.28, offset: [0.
|
|
9606
|
-
{ at: 0.43, offset: [-0.
|
|
9607
|
-
{ at: 0.6, offset: [-0.
|
|
9607
|
+
{ at: 0.28, offset: [0.03, -0.05, 0.08], turn: [0.15, -0.1, 0] },
|
|
9608
|
+
{ at: 0.43, offset: [-0.1, 0.07, -0.12], turn: [0.1, 0.55, 0] },
|
|
9609
|
+
{ at: 0.6, offset: [-0.1, 0.07, -0.11], turn: [0.1, 0.52, 0] },
|
|
9610
|
+
{ at: 1, ...HOLD }
|
|
9611
|
+
]
|
|
9612
|
+
};
|
|
9613
|
+
var BAT_SWING = {
|
|
9614
|
+
pivot: "grip",
|
|
9615
|
+
keys: [
|
|
9616
|
+
{ at: 0, ...HOLD },
|
|
9617
|
+
{ at: 0.29, offset: [0.12, 0.12, 0.1], turn: [1.9, -0.6, 0] },
|
|
9618
|
+
{ at: 0.43, offset: [-0.1, 0.04, -0.07], turn: [-0.3, 1.2, 0] },
|
|
9619
|
+
{ at: 0.64, offset: [-0.28, 0.1, 0], turn: [2, 1, 0] },
|
|
9620
|
+
{ at: 0.8, offset: [-0.2, 0.06, 0.02], turn: [1.8, 0.8, 0] },
|
|
9608
9621
|
{ at: 1, ...HOLD }
|
|
9609
9622
|
]
|
|
9610
9623
|
};
|
|
@@ -9620,7 +9633,8 @@ var ONE_HAND_CHOP = {
|
|
|
9620
9633
|
var FAMILY_MOTIONS = /* @__PURE__ */ new Map([
|
|
9621
9634
|
["short_blade", /* @__PURE__ */ new Map([["slash", KNIFE_SLASH], ["stab", KNIFE_STAB]])],
|
|
9622
9635
|
["one_hand_swing", /* @__PURE__ */ new Map([["chop", ONE_HAND_CHOP]])],
|
|
9623
|
-
|
|
9636
|
+
["bat_swing", /* @__PURE__ */ new Map([["bat_swing", BAT_SWING]])],
|
|
9637
|
+
// an axe or a pickaxe swung with both hands goes as the shovel's swing
|
|
9624
9638
|
["two_hand_swing", /* @__PURE__ */ new Map([["swing", SHOVEL_SWING]])]
|
|
9625
9639
|
]);
|
|
9626
9640
|
var TOOL_MOTIONS = new Map([
|
|
@@ -9919,7 +9933,13 @@ var SHIPPED_WEAPON_ITEM_MODELS = [
|
|
|
9919
9933
|
// the blade of the KA-BAR and of the katana is the narrow end of the lying item, so the head is turned to +x; the katana is held with both hands on its long handle (the left 11 cm behind the right: 0.1122 of its 0.98 m); the brass knuckles lie with the ring row across the strike
|
|
9920
9934
|
["kabar", { flip: true }],
|
|
9921
9935
|
["katana", { flip: true, grips: { handle: -0.35, support: -0.4622 } }],
|
|
9922
|
-
["brass_knuckles", { turn: 1, roll: 1, grips: { handle: -0.35, handleAt: [-0.045, 0.03] } }]
|
|
9936
|
+
["brass_knuckles", { turn: 1, roll: 1, grips: { handle: -0.35, handleAt: [-0.045, 0.03] } }],
|
|
9937
|
+
// a club is swung with both hands at the knob end as a batter holds it: the left hand below at the knob, the right just above it (a sledgehammer's right hand higher up the haft)
|
|
9938
|
+
["baseball_bat", { grips: { handle: -0.3, support: -0.41 } }],
|
|
9939
|
+
["nail_bat", { grips: { handle: -0.3, support: -0.41 } }],
|
|
9940
|
+
["iron_pipe", { grips: { handle: -0.29, support: -0.41 } }],
|
|
9941
|
+
["crowbar", { grips: { handle: -0.3, support: -0.42 } }],
|
|
9942
|
+
["sledgehammer", { grips: { handle: -0.22, support: -0.42 } }]
|
|
9923
9943
|
];
|
|
9924
9944
|
var hasThrowableModel = (def) => def.action?.kind === "throwable" && def.action.explosive !== void 0 && hasExplosiveModel(def.action.explosive);
|
|
9925
9945
|
var buildThrowableModel = (THREE, def) => def.action?.kind === "throwable" && def.action.explosive !== void 0 ? buildExplosiveModel(THREE, def.action.explosive) : void 0;
|
|
@@ -9950,6 +9970,7 @@ var buildItemWeaponModel = (THREE, def, items) => defaultWeaponProps().buildItem
|
|
|
9950
9970
|
var buildWeaponModel = (THREE, def, items) => defaultWeaponProps().buildModel(THREE, def, items);
|
|
9951
9971
|
|
|
9952
9972
|
// src/box-fx.ts
|
|
9973
|
+
var TOOL_REACH = 0.47;
|
|
9953
9974
|
var EJECTS_ON_SHOT = /* @__PURE__ */ new Set(["pistol", "smg", "carbine", "rifle", "sniper", "shotgun"]);
|
|
9954
9975
|
var SPOUTS = /* @__PURE__ */ new Set(["firearm", "flame", "heat", "extinguisher"]);
|
|
9955
9976
|
var DROPS_MAGAZINE = /* @__PURE__ */ new Set(["pistol", "smg", "carbine", "rifle", "sniper"]);
|
|
@@ -9980,8 +10001,27 @@ function createBoxFx(options) {
|
|
|
9980
10001
|
const applyMotion = (frame) => {
|
|
9981
10002
|
if (!motion) return;
|
|
9982
10003
|
const at2 = sampleToolMotion(motion.clip, motion.elapsed / motion.duration);
|
|
9983
|
-
|
|
10004
|
+
const anchor = motion.clip.pivot === "grip" ? heldAnchor(heldHold()) : null;
|
|
10005
|
+
if (anchor) {
|
|
10006
|
+
hand.updateMatrixWorld(true);
|
|
10007
|
+
anchor.part.localToWorld(gripBefore.copy(anchor.offset));
|
|
10008
|
+
}
|
|
9984
10009
|
hand.quaternion.multiply(q.setFromEuler(new THREE.Euler(at2.turn[0], at2.turn[1], at2.turn[2])));
|
|
10010
|
+
if (anchor) {
|
|
10011
|
+
hand.updateMatrixWorld(true);
|
|
10012
|
+
hand.position.add(gripBefore.sub(anchor.part.localToWorld(gripAfter.copy(anchor.offset))));
|
|
10013
|
+
}
|
|
10014
|
+
hand.position.add(v.set(at2.offset[0], at2.offset[1], at2.offset[2]).applyQuaternion(frame));
|
|
10015
|
+
};
|
|
10016
|
+
const keepInReach = (shoulder) => {
|
|
10017
|
+
const anchor = heldAnchor(heldHold());
|
|
10018
|
+
if (!anchor) return;
|
|
10019
|
+
hand.updateMatrixWorld(true);
|
|
10020
|
+
const away = anchor.part.localToWorld(gripAfter.copy(anchor.offset)).sub(gripBefore.set(shoulder[0], shoulder[1], shoulder[2]));
|
|
10021
|
+
const distance = away.length();
|
|
10022
|
+
if (distance <= TOOL_REACH) return;
|
|
10023
|
+
hand.position.sub(away.multiplyScalar(1 - TOOL_REACH / distance));
|
|
10024
|
+
hand.updateMatrixWorld(true);
|
|
9985
10025
|
};
|
|
9986
10026
|
let dip = 0;
|
|
9987
10027
|
let reloading = false;
|
|
@@ -10001,6 +10041,8 @@ function createBoxFx(options) {
|
|
|
10001
10041
|
const frontOf = new THREE.Vector3();
|
|
10002
10042
|
const restBox = new THREE.Box3();
|
|
10003
10043
|
const noMotion = new THREE.Vector3();
|
|
10044
|
+
const gripBefore = new THREE.Vector3();
|
|
10045
|
+
const gripAfter = new THREE.Vector3();
|
|
10004
10046
|
let inLens = false;
|
|
10005
10047
|
const setLens = (on) => {
|
|
10006
10048
|
if (on !== inLens) options.viewmodelFov?.(on ? VIEW_HOLD.tool.fov : null);
|
|
@@ -10200,8 +10242,9 @@ function createBoxFx(options) {
|
|
|
10200
10242
|
hand.position.add(v.set(0, -0.12 * dip, 0.05 * kick).applyQuaternion(camera.quaternion));
|
|
10201
10243
|
q.setFromEuler(new THREE.Euler(0.14 * kick - 0.25 * dip, 0, 0.6 * dip));
|
|
10202
10244
|
hand.quaternion.multiply(q);
|
|
10203
|
-
const body =
|
|
10204
|
-
applyMotion(bodyFrame.set(body[0], body[1], body[2], body[3]));
|
|
10245
|
+
const body = options.bodyHold?.() ?? eyeFrame();
|
|
10246
|
+
applyMotion(bodyFrame.set(body.quaternion[0], body.quaternion[1], body.quaternion[2], body.quaternion[3]));
|
|
10247
|
+
if (motion) keepInReach(body.position);
|
|
10205
10248
|
}
|
|
10206
10249
|
stow(dt);
|
|
10207
10250
|
for (const body of [...bodies]) {
|
|
@@ -16099,4 +16142,4 @@ export {
|
|
|
16099
16142
|
DEFAULT_EXPLOSIVES_SCENE,
|
|
16100
16143
|
createExplosivesTestModule
|
|
16101
16144
|
};
|
|
16102
|
-
//# sourceMappingURL=chunk-
|
|
16145
|
+
//# sourceMappingURL=chunk-5IW5LQG6.js.map
|