@adatechnology/game-weapons-three 0.24.4 → 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 +7 -0
- package/dist/{chunk-4MNVYCNY.js → chunk-CGGF5CDD.js} +158 -57
- package/dist/chunk-CGGF5CDD.js.map +1 -0
- package/dist/index.d.ts +44 -3
- package/dist/index.global.js +249 -147
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +13 -1
- package/dist/index.js.map +1 -1
- package/dist/{testing-eyLz_C6A.d.ts → testing-C9yn3tJI.d.ts} +3 -0
- package/dist/testing.d.ts +2 -1
- package/dist/testing.js +1 -1
- package/package.json +7 -5
- package/dist/chunk-4MNVYCNY.js.map +0 -1
package/dist/index.global.js
CHANGED
|
@@ -43,6 +43,7 @@ var GameWeaponsThree = (() => {
|
|
|
43
43
|
HOLSTER_TOSS: () => HOLSTER_TOSS,
|
|
44
44
|
LAUNCH_SAMPLE: () => LAUNCH_SAMPLE,
|
|
45
45
|
LAUNCH_SOUND_IDS: () => LAUNCH_SOUND_IDS,
|
|
46
|
+
LOOSE_ROLLING_RESISTANCE: () => LOOSE_ROLLING_RESISTANCE,
|
|
46
47
|
MECHANICAL_SOUNDS: () => MECHANICAL_SOUNDS,
|
|
47
48
|
MODEL_ENTRIES: () => MODEL_ENTRIES,
|
|
48
49
|
MOUNTED_M134_ITEM_ID: () => MOUNTED_M134_ITEM_ID,
|
|
@@ -74,6 +75,7 @@ var GameWeaponsThree = (() => {
|
|
|
74
75
|
buildWeaponModel: () => buildWeaponModel,
|
|
75
76
|
buildWeaponModelById: () => buildWeaponModelById,
|
|
76
77
|
cartridgeShape: () => cartridgeShape,
|
|
78
|
+
casingCollider: () => casingCollider,
|
|
77
79
|
computeCasingSound: () => computeCasingSound,
|
|
78
80
|
computeFlyby: () => computeFlyby,
|
|
79
81
|
computeGunshot: () => computeGunshot,
|
|
@@ -88,6 +90,8 @@ var GameWeaponsThree = (() => {
|
|
|
88
90
|
createWorldExplosiveShells: () => createWorldExplosiveShells,
|
|
89
91
|
defaultWeaponProps: () => defaultWeaponProps,
|
|
90
92
|
deriveFrames: () => deriveFrames,
|
|
93
|
+
dropLoose: () => dropLoose,
|
|
94
|
+
explosiveCollider: () => explosiveCollider,
|
|
91
95
|
explosivesTextOf: () => explosivesTextOf,
|
|
92
96
|
fitAttachmentModels: () => fitAttachmentModels,
|
|
93
97
|
hasExplosiveModel: () => hasExplosiveModel,
|
|
@@ -105,6 +109,8 @@ var GameWeaponsThree = (() => {
|
|
|
105
109
|
rigStock: () => rigStock,
|
|
106
110
|
rigUnderbarrel: () => rigUnderbarrel,
|
|
107
111
|
sampleToolMotion: () => sampleToolMotion,
|
|
112
|
+
spawnLoose: () => spawnLoose,
|
|
113
|
+
syncLoose: () => syncLoose,
|
|
108
114
|
toWorldLens: () => toWorldLens,
|
|
109
115
|
weaponProp: () => weaponProp,
|
|
110
116
|
weaponSampleBank: () => weaponSampleBank,
|
|
@@ -435,8 +441,8 @@ var GameWeaponsThree = (() => {
|
|
|
435
441
|
];
|
|
436
442
|
var sampleClip = (clip, partId, time) => {
|
|
437
443
|
const points = clip.keys.map((key2) => {
|
|
438
|
-
const
|
|
439
|
-
return { t: key2.t, position:
|
|
444
|
+
const pose2 = partId === void 0 ? key2 : key2.parts?.[partId];
|
|
445
|
+
return { t: key2.t, position: pose2?.position ?? ZERO, rotation: pose2?.rotation ?? ZERO };
|
|
440
446
|
});
|
|
441
447
|
const first = points[0];
|
|
442
448
|
if (!first || first.t > 0) points.unshift({ t: 0, position: ZERO, rotation: ZERO });
|
|
@@ -15415,16 +15421,16 @@ var GameWeaponsThree = (() => {
|
|
|
15415
15421
|
var EPS = 1e-9;
|
|
15416
15422
|
var STILL_STEPS = 2;
|
|
15417
15423
|
var STILL_SHARE = 0.05;
|
|
15418
|
-
var bounce = (
|
|
15419
|
-
const along2 = dot(
|
|
15420
|
-
if (along2 >= 0) return
|
|
15424
|
+
var bounce = (velocity2, normal, ground, rules) => {
|
|
15425
|
+
const along2 = dot(velocity2, normal);
|
|
15426
|
+
if (along2 >= 0) return velocity2;
|
|
15421
15427
|
const restitution = ground ? rules.groundRestitution : rules.wallRestitution;
|
|
15422
15428
|
const friction = ground ? rules.groundFriction : 1;
|
|
15423
15429
|
const normalPart = [normal[0] * along2, normal[1] * along2, normal[2] * along2];
|
|
15424
15430
|
return [
|
|
15425
|
-
(
|
|
15426
|
-
(
|
|
15427
|
-
(
|
|
15431
|
+
(velocity2[0] - normalPart[0]) * friction - normalPart[0] * restitution,
|
|
15432
|
+
(velocity2[1] - normalPart[1]) * friction - normalPart[1] * restitution,
|
|
15433
|
+
(velocity2[2] - normalPart[2]) * friction - normalPart[2] * restitution
|
|
15428
15434
|
];
|
|
15429
15435
|
};
|
|
15430
15436
|
var ExplosiveBody = class {
|
|
@@ -15605,13 +15611,13 @@ var GameWeaponsThree = (() => {
|
|
|
15605
15611
|
return range3[0] + (range3[1] - range3[0]) * random();
|
|
15606
15612
|
};
|
|
15607
15613
|
var launcherUses = ({ action, explosive, origin, direction, armDistance }) => {
|
|
15608
|
-
const
|
|
15614
|
+
const velocity2 = [direction[0] * action.speed, direction[1] * action.speed, direction[2] * action.speed];
|
|
15609
15615
|
const projectile = {
|
|
15610
15616
|
kind: "throw",
|
|
15611
15617
|
energy: explosive?.energy ?? 0,
|
|
15612
15618
|
radius: explosive?.lethalRadius ?? 0,
|
|
15613
15619
|
fuse: 0,
|
|
15614
|
-
velocity,
|
|
15620
|
+
velocity: velocity2,
|
|
15615
15621
|
origin,
|
|
15616
15622
|
explosive: action.projectile,
|
|
15617
15623
|
trigger: "impact",
|
|
@@ -15643,8 +15649,8 @@ var GameWeaponsThree = (() => {
|
|
|
15643
15649
|
var throwableUse = (params) => {
|
|
15644
15650
|
const { action, explosive, origin, direction, fuse, cooked, inHand } = params;
|
|
15645
15651
|
if (explosive && isPlaced(explosive, fuse, params.rules)) return placedUse({ ...params, explosive });
|
|
15646
|
-
const
|
|
15647
|
-
const use = { kind: "throw", energy: action.energy, radius: action.radius, fuse, velocity, origin };
|
|
15652
|
+
const velocity2 = inHand ? [0, 0, 0] : [direction[0] * action.throwSpeed, direction[1] * action.throwSpeed + action.throwSpeed * THROW_LIFT, direction[2] * action.throwSpeed];
|
|
15653
|
+
const use = { kind: "throw", energy: action.energy, radius: action.radius, fuse, velocity: velocity2, origin };
|
|
15648
15654
|
if (cooked !== void 0) use.cooked = cooked;
|
|
15649
15655
|
if (inHand) use.inHand = true;
|
|
15650
15656
|
if (action.fire) use.fire = { ...action.fire };
|
|
@@ -24726,37 +24732,37 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
24726
24732
|
if (shape.kind === "cylinder") return [shape.radius, shape.height / 2, shape.radius];
|
|
24727
24733
|
return [shape.radius, shape.radius, shape.radius];
|
|
24728
24734
|
};
|
|
24729
|
-
var hostedSolids = (spec, state,
|
|
24735
|
+
var hostedSolids = (spec, state, pose2) => {
|
|
24730
24736
|
const byId = new Map((state?.parts ?? []).map((p) => [p.id, p]));
|
|
24731
24737
|
const out = [];
|
|
24732
24738
|
for (const ps of spec.parts) {
|
|
24733
24739
|
const st = byId.get(ps.id);
|
|
24734
24740
|
if (st && (GONE.has(st.status) || st.group !== 0)) continue;
|
|
24735
|
-
const ov =
|
|
24736
|
-
const center = toWorld(
|
|
24737
|
-
const rotation2 = quat.mul(
|
|
24741
|
+
const ov = pose2.poses.get(ps.id);
|
|
24742
|
+
const center = toWorld(pose2.position, pose2.rotation, ov?.pos ?? ps.position);
|
|
24743
|
+
const rotation2 = quat.mul(pose2.rotation, ov?.q ?? quatFromEuler(...ps.rotation ?? [0, 0, 0]));
|
|
24738
24744
|
out.push({ center, half: halfOf(ps.shape), rotation: rotation2 });
|
|
24739
24745
|
}
|
|
24740
24746
|
return out;
|
|
24741
24747
|
};
|
|
24742
24748
|
var placedPieces = /* @__PURE__ */ new WeakMap();
|
|
24743
24749
|
var isSamePose = ({ known, position, rotation: rotation2 }) => known.position[0] === position[0] && known.position[1] === position[1] && known.position[2] === position[2] && known.rotation[0] === rotation2[0] && known.rotation[1] === rotation2[1] && known.rotation[2] === rotation2[2] && known.rotation[3] === rotation2[3];
|
|
24744
|
-
var hostedPieces = (pieces,
|
|
24750
|
+
var hostedPieces = (pieces, pose2) => pieces.map((piece2, index) => {
|
|
24745
24751
|
const known = placedPieces.get(piece2);
|
|
24746
|
-
const p =
|
|
24752
|
+
const p = pose2.position, q = pose2.rotation;
|
|
24747
24753
|
const isSamePlace = known !== void 0 && (piece2.key !== void 0 || known.index === index) && isSamePose({ known, position: p, rotation: q });
|
|
24748
24754
|
if (known && isSamePlace) return known.solid;
|
|
24749
|
-
const solid2 = placedPiece(piece2, index,
|
|
24755
|
+
const solid2 = placedPiece(piece2, index, pose2);
|
|
24750
24756
|
placedPieces.set(piece2, { position: [p[0], p[1], p[2]], rotation: [q[0], q[1], q[2], q[3]], index, solid: solid2 });
|
|
24751
24757
|
return solid2;
|
|
24752
24758
|
});
|
|
24753
|
-
var placedPiece = (piece2, index,
|
|
24754
|
-
const base = { center: toWorld(
|
|
24759
|
+
var placedPiece = (piece2, index, pose2) => {
|
|
24760
|
+
const base = { center: toWorld(pose2.position, pose2.rotation, piece2.center), half: piece2.half, rotation: quat.mul(pose2.rotation, piece2.rotation), key: piece2.key ?? `${piece2.id}:${index}` };
|
|
24755
24761
|
if (!piece2.mesh) return base;
|
|
24756
24762
|
const source = piece2.mesh.vertices;
|
|
24757
24763
|
const vertices = new Float32Array(source.length);
|
|
24758
24764
|
for (let i = 0; i < source.length; i += 3) {
|
|
24759
|
-
const world = toWorld(
|
|
24765
|
+
const world = toWorld(pose2.position, pose2.rotation, [source[i], source[i + 1], source[i + 2]]);
|
|
24760
24766
|
vertices[i] = world[0];
|
|
24761
24767
|
vertices[i + 1] = world[1];
|
|
24762
24768
|
vertices[i + 2] = world[2];
|
|
@@ -53681,8 +53687,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
53681
53687
|
}
|
|
53682
53688
|
}
|
|
53683
53689
|
connect(e, spec, valves);
|
|
53684
|
-
const
|
|
53685
|
-
world.add(e.id, spec, { x:
|
|
53690
|
+
const pose2 = at(e.item);
|
|
53691
|
+
world.add(e.id, spec, { x: pose2.x, y: e.floorY, z: pose2.z, ry: pose2.ry });
|
|
53686
53692
|
out.added++;
|
|
53687
53693
|
if (!isBlocked2) continue;
|
|
53688
53694
|
for (const p of spec.parts || []) {
|
|
@@ -54889,7 +54895,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
54889
54895
|
}
|
|
54890
54896
|
var residentialTower = residentialTowerTemplate();
|
|
54891
54897
|
|
|
54892
|
-
// ../game-floorplan-three/dist/chunk-
|
|
54898
|
+
// ../game-floorplan-three/dist/chunk-ANCD3HXE.js
|
|
54893
54899
|
var __defProp4 = Object.defineProperty;
|
|
54894
54900
|
var __defNormalProp2 = (obj, key2, value) => key2 in obj ? __defProp4(obj, key2, { enumerable: true, configurable: true, writable: true, value }) : obj[key2] = value;
|
|
54895
54901
|
var __publicField2 = (obj, key2, value) => __defNormalProp2(obj, typeof key2 !== "symbol" ? key2 + "" : key2, value);
|
|
@@ -67329,6 +67335,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
67329
67335
|
}
|
|
67330
67336
|
var FLOOR_TOUCH2 = 5e-3;
|
|
67331
67337
|
var LOOSE = /* @__PURE__ */ new Set(["paper"]);
|
|
67338
|
+
var PLANTED = /* @__PURE__ */ new Set(["mailbox", "correio", "clothesline", "tree_small", "bbq_simple"]);
|
|
67332
67339
|
var BASE_MATERIAL = {
|
|
67333
67340
|
wood: "wood_hard",
|
|
67334
67341
|
metal: "steel",
|
|
@@ -67440,7 +67447,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
67440
67447
|
const wallMounted = parts2.some((part) => part.anchored && low(part) > FLOOR_TOUCH2);
|
|
67441
67448
|
const sunk = parts2.some((part) => low(part) < -FLOOR_TOUCH2);
|
|
67442
67449
|
const rooted = parts2.some((part) => part.material === "foliage") && parts2.some((part) => part.material.startsWith("wood") && low(part) <= FLOOR_TOUCH2);
|
|
67443
|
-
const fixed2 = wallMounted || sunk || rooted;
|
|
67450
|
+
const fixed2 = wallMounted || sunk || rooted || PLANTED.has(name);
|
|
67444
67451
|
const all = drawn.reduce(
|
|
67445
67452
|
(m, p) => ({ x0: Math.min(m.x0, p.min[0]), x1: Math.max(m.x1, p.max[0]), z0: Math.min(m.z0, p.min[2]), z1: Math.max(m.z1, p.max[2]) }),
|
|
67446
67453
|
{ x0: Infinity, x1: -Infinity, z0: Infinity, z1: -Infinity }
|
|
@@ -81214,9 +81221,9 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
81214
81221
|
hold.works?.forEach((work, index) => {
|
|
81215
81222
|
const k = weights2?.[index] ?? 0;
|
|
81216
81223
|
if (k <= 0) return;
|
|
81217
|
-
const
|
|
81218
|
-
if (work.hand === "R") right = right ? blendPose(THREE, right,
|
|
81219
|
-
else left = left ? blendPose(THREE, left,
|
|
81224
|
+
const pose2 = poseOf(work.anchor, rootQuaternion);
|
|
81225
|
+
if (work.hand === "R") right = right ? blendPose(THREE, right, pose2, k) : pose2;
|
|
81226
|
+
else left = left ? blendPose(THREE, left, pose2, k) : pose2;
|
|
81220
81227
|
});
|
|
81221
81228
|
const targets = { R: right, L: left, grip: hold.grip, gripL: hold.gripLeft, scale: hold.scale };
|
|
81222
81229
|
if (hold.slideLeft && left) {
|
|
@@ -81973,13 +81980,13 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
81973
81980
|
}
|
|
81974
81981
|
var REGION_NAMES = ["wall", "sidewalk", "curb", "road"];
|
|
81975
81982
|
var dot3 = (a, b) => a[0] * b[0] + a[1] * b[1] + a[2] * b[2];
|
|
81976
|
-
function impactOf(region, position,
|
|
81983
|
+
function impactOf(region, position, velocity2, cellSize) {
|
|
81977
81984
|
const local2 = [position[0] - region.origin[0], position[1] - region.origin[1], position[2] - region.origin[2]];
|
|
81978
81985
|
return {
|
|
81979
81986
|
row: region.firstRow + dot3(local2, region.rowAxis) / cellSize,
|
|
81980
81987
|
column: dot3(local2, region.columnAxis) / cellSize,
|
|
81981
|
-
along: [dot3(
|
|
81982
|
-
normalSpeed: -dot3(
|
|
81988
|
+
along: [dot3(velocity2, region.columnAxis), dot3(velocity2, region.rowAxis)],
|
|
81989
|
+
normalSpeed: -dot3(velocity2, region.normal)
|
|
81983
81990
|
};
|
|
81984
81991
|
}
|
|
81985
81992
|
function cellToWorldOf(regions, cellSize, row, column) {
|
|
@@ -82079,7 +82086,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
82079
82086
|
}
|
|
82080
82087
|
return -1;
|
|
82081
82088
|
},
|
|
82082
|
-
impact: (region, position,
|
|
82089
|
+
impact: (region, position, velocity2) => impactOf(regions[region], position, velocity2, cellSize),
|
|
82083
82090
|
contains: (position) => position[0] > originX && position[0] < maxX && (!rules.clipRoadEnd || position[2] < roadEndZ),
|
|
82084
82091
|
escaped(position) {
|
|
82085
82092
|
if (position[1] < -1) return true;
|
|
@@ -88722,11 +88729,17 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
88722
88729
|
}
|
|
88723
88730
|
|
|
88724
88731
|
// src/models/explosives.ts
|
|
88732
|
+
var M67_PARTS = {
|
|
88733
|
+
bodyRadius: 0.032,
|
|
88734
|
+
fuze: { radius: 0.011, height: 0.022, y: 0.04 },
|
|
88735
|
+
spoon: { size: [0.012, 0.07, 6e-3], x: 0.016, y: 0.018, tilt: 0.2 }
|
|
88736
|
+
};
|
|
88725
88737
|
var grenade = (kit, group) => {
|
|
88726
88738
|
const { M, sphere: sphere2, cylinderY, box: box5, torus: torus2, THREE } = kit;
|
|
88727
|
-
|
|
88728
|
-
|
|
88729
|
-
|
|
88739
|
+
const { bodyRadius, fuze, spoon } = M67_PARTS;
|
|
88740
|
+
sphere2(group, bodyRadius, M.olive, 0, bodyRadius, 0, 1);
|
|
88741
|
+
cylinderY(group, fuze.radius, fuze.height, M.metal, 0, bodyRadius + fuze.y, 0);
|
|
88742
|
+
box5(group, ...spoon.size, M.metal, spoon.x, bodyRadius + spoon.y, 0, spoon.tilt);
|
|
88730
88743
|
torus2(group, new THREE.TorusGeometry(85e-4, 16e-4, 6, 12), M.steel, -0.012, 0.082, 0);
|
|
88731
88744
|
kit.mark(group, 0, 0.032, 0).name = "handle";
|
|
88732
88745
|
};
|
|
@@ -88966,7 +88979,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
88966
88979
|
model.position.lerpVectors(holderAt, model.position, k);
|
|
88967
88980
|
hand.updateMatrixWorld(true);
|
|
88968
88981
|
};
|
|
88969
|
-
const throwBody = (kind, mesh3, from,
|
|
88982
|
+
const throwBody = (kind, mesh3, from, velocity2, radius) => {
|
|
88970
88983
|
if (!(kind === "casing" ? layers.casings : layers.magazines)) {
|
|
88971
88984
|
mesh3.geometry.dispose();
|
|
88972
88985
|
return;
|
|
@@ -88977,7 +88990,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
88977
88990
|
mesh3.position.copy(from);
|
|
88978
88991
|
mesh3.castShadow = true;
|
|
88979
88992
|
scene.add(mesh3);
|
|
88980
|
-
bodies.push({ mesh: mesh3, velocity, spin: new THREE.Vector3(random() * 20 - 10, random() * 30 - 15, random() * 20 - 10), radius, age: 0, resting: false, bounces: 0, kind });
|
|
88993
|
+
bodies.push({ mesh: mesh3, velocity: velocity2, spin: new THREE.Vector3(random() * 20 - 10, random() * 30 - 15, random() * 20 - 10), radius, age: 0, resting: false, bounces: 0, kind });
|
|
88981
88994
|
};
|
|
88982
88995
|
const ejectCasing = (caliberMm, isShell, downward) => {
|
|
88983
88996
|
const radius = isShell ? 0.0105 : Math.max(3e-3, caliberMm / 1e3 * 0.6);
|
|
@@ -88987,8 +89000,8 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
88987
89000
|
const from = handPoint(0.03, 0.03, 0.05, new THREE.Vector3());
|
|
88988
89001
|
const right = new THREE.Vector3(1, 0, 0).applyQuaternion(camera2.quaternion);
|
|
88989
89002
|
const up = new THREE.Vector3(0, 1, 0);
|
|
88990
|
-
const
|
|
88991
|
-
throwBody("casing", mesh3, from,
|
|
89003
|
+
const velocity2 = downward ? up.clone().multiplyScalar(-0.5).addScaledVector(right, (random() - 0.5) * 0.4) : right.multiplyScalar(1.6 + random() * 0.8).addScaledVector(up, 1.4 + random() * 0.8);
|
|
89004
|
+
throwBody("casing", mesh3, from, velocity2, radius);
|
|
88992
89005
|
};
|
|
88993
89006
|
const dropMagazine = (category) => {
|
|
88994
89007
|
const long = category === "rifle" || category === "sniper" || category === "carbine";
|
|
@@ -89189,14 +89202,14 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
89189
89202
|
const poses = /* @__PURE__ */ new Map();
|
|
89190
89203
|
for (const [key2, list2] of channels) {
|
|
89191
89204
|
const [part, channel, axis2] = key2.split("|");
|
|
89192
|
-
const
|
|
89193
|
-
|
|
89194
|
-
poses.set(part,
|
|
89205
|
+
const pose2 = poses.get(part) ?? { position: [0, 0, 0], rotation: [0, 0, 0] };
|
|
89206
|
+
pose2[channel][AXIS_INDEX[axis2]] = round3(valueAt(list2, t, includeInstants));
|
|
89207
|
+
poses.set(part, pose2);
|
|
89195
89208
|
}
|
|
89196
89209
|
const root = poses.get(ROOT2);
|
|
89197
89210
|
poses.delete(ROOT2);
|
|
89198
89211
|
const parts2 = {};
|
|
89199
|
-
for (const [part,
|
|
89212
|
+
for (const [part, pose2] of poses) parts2[part] = pose2;
|
|
89200
89213
|
return { t, ...root ? { position: root.position, rotation: root.rotation } : {}, ...poses.size ? { parts: parts2 } : {} };
|
|
89201
89214
|
};
|
|
89202
89215
|
const keys = [];
|
|
@@ -91795,12 +91808,12 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
91795
91808
|
return false;
|
|
91796
91809
|
}
|
|
91797
91810
|
};
|
|
91798
|
-
function slideInto(out,
|
|
91799
|
-
const into =
|
|
91811
|
+
function slideInto(out, velocity2) {
|
|
91812
|
+
const into = velocity2.vx * out.nx + velocity2.vy * out.ny + velocity2.vz * out.nz;
|
|
91800
91813
|
if (into >= 0) return;
|
|
91801
|
-
|
|
91802
|
-
|
|
91803
|
-
|
|
91814
|
+
velocity2.vx -= into * out.nx;
|
|
91815
|
+
velocity2.vy -= into * out.ny;
|
|
91816
|
+
velocity2.vz -= into * out.nz;
|
|
91804
91817
|
}
|
|
91805
91818
|
function slideAlong(out, vx2, vy2, vz2) {
|
|
91806
91819
|
const into = vx2 * out.nx + vy2 * out.ny + vz2 * out.nz;
|
|
@@ -94034,10 +94047,10 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
94034
94047
|
var FLASH_SCALE = variable("flash");
|
|
94035
94048
|
var fallback = (name, defaultValue) => ite(ne(variable(name), void 0), variable(name), defaultValue);
|
|
94036
94049
|
var wide = (width) => mul(sub(rand(), 0.5), width);
|
|
94037
|
-
var puff2 = (point,
|
|
94050
|
+
var puff2 = (point, velocity2, world, radius, life, opacity, growth = SMOKE.growth) => mesh2({
|
|
94038
94051
|
shape: "sphere",
|
|
94039
94052
|
p: point,
|
|
94040
|
-
v:
|
|
94053
|
+
v: velocity2,
|
|
94041
94054
|
wv: world,
|
|
94042
94055
|
r: radius,
|
|
94043
94056
|
seg: SMOKE.width,
|
|
@@ -94051,9 +94064,9 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
94051
94064
|
drag: SMOKE.drag,
|
|
94052
94065
|
grow: growth
|
|
94053
94066
|
});
|
|
94054
|
-
var flameBit = (point,
|
|
94067
|
+
var flameBit = (point, velocity2, world, radius, life) => [
|
|
94055
94068
|
set("bitPoint", point),
|
|
94056
|
-
set("bitVelocity",
|
|
94069
|
+
set("bitVelocity", velocity2),
|
|
94057
94070
|
set("bitWorld", world),
|
|
94058
94071
|
set("bitRadius", radius),
|
|
94059
94072
|
set("bitLife", life),
|
|
@@ -94484,7 +94497,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
94484
94497
|
var clamp32 = (value, low, high) => value < low ? low : value > high ? high : value;
|
|
94485
94498
|
function createCylinderBehavior() {
|
|
94486
94499
|
let position = SPOT2;
|
|
94487
|
-
let
|
|
94500
|
+
let velocity2 = [0, 0, 0];
|
|
94488
94501
|
let rotationZ = 0;
|
|
94489
94502
|
let angle = 0;
|
|
94490
94503
|
let spin = 0;
|
|
@@ -94493,7 +94506,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
94493
94506
|
let direction = [1, 0, 0];
|
|
94494
94507
|
const clear = () => {
|
|
94495
94508
|
position = SPOT2;
|
|
94496
|
-
|
|
94509
|
+
velocity2 = [0, 0, 0];
|
|
94497
94510
|
rotationZ = 0;
|
|
94498
94511
|
angle = 0;
|
|
94499
94512
|
spin = 0;
|
|
@@ -94508,7 +94521,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
94508
94521
|
oxygen = args.oxygen;
|
|
94509
94522
|
} else if (action === "puncture") {
|
|
94510
94523
|
live = true;
|
|
94511
|
-
if (oxygen)
|
|
94524
|
+
if (oxygen) velocity2 = [-5, 0, -0.3];
|
|
94512
94525
|
else spin = 9;
|
|
94513
94526
|
} else if (action === "step") {
|
|
94514
94527
|
if (!live) return;
|
|
@@ -94522,18 +94535,18 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
94522
94535
|
position = [position[0] + direction[0] * (-0.6 * k * dt), y + direction[1] * (-0.6 * k * dt), position[2] + direction[2] * (-0.6 * k * dt)];
|
|
94523
94536
|
return;
|
|
94524
94537
|
}
|
|
94525
|
-
let [vx2, vy2, vz2] =
|
|
94538
|
+
let [vx2, vy2, vz2] = velocity2;
|
|
94526
94539
|
if (k > 0) vx2 -= 4 * k * dt;
|
|
94527
94540
|
const damping = Math.exp(-dt * (k > 0 ? 0.3 : 3));
|
|
94528
94541
|
vx2 *= damping;
|
|
94529
94542
|
vy2 *= damping;
|
|
94530
94543
|
vz2 *= damping;
|
|
94531
|
-
|
|
94544
|
+
velocity2 = [vx2, vy2, vz2];
|
|
94532
94545
|
rotationZ = lerp3(rotationZ, -QUARTER_TURN2, dt * 10);
|
|
94533
94546
|
position = [position[0] + vx2 * dt, lerp3(position[1], 0.12, dt * 10) + vy2 * dt, position[2] + vz2 * dt];
|
|
94534
94547
|
if (position[0] < WALL_X) {
|
|
94535
94548
|
position = [WALL_X, position[1], position[2]];
|
|
94536
|
-
|
|
94549
|
+
velocity2 = [velocity2[0] * -0.3, velocity2[1], velocity2[2]];
|
|
94537
94550
|
host.engine.screen.shake += 0.08;
|
|
94538
94551
|
sparkAt(host.engine, position, normalized([1, 0.5, 0]), 16, 1);
|
|
94539
94552
|
}
|
|
@@ -94550,7 +94563,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
94550
94563
|
case "direction":
|
|
94551
94564
|
return direction;
|
|
94552
94565
|
case "speed_x":
|
|
94553
|
-
return
|
|
94566
|
+
return velocity2[0];
|
|
94554
94567
|
case "rotation_z":
|
|
94555
94568
|
return rotationZ;
|
|
94556
94569
|
case "tip":
|
|
@@ -95321,10 +95334,10 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
95321
95334
|
return { origin, anchor: entry2.anchor, yaw: entry2.yaw, ...entry2.orientation ? { orientation: entry2.orientation } : {} };
|
|
95322
95335
|
}
|
|
95323
95336
|
function moveCarrier(entry2) {
|
|
95324
|
-
const
|
|
95325
|
-
if (!
|
|
95326
|
-
entry2.carrier.origin = [
|
|
95327
|
-
if (
|
|
95337
|
+
const pose2 = entry2.track?.();
|
|
95338
|
+
if (!pose2 || !entry2.carrier) return;
|
|
95339
|
+
entry2.carrier.origin = [pose2.point[0], pose2.point[1], pose2.point[2]];
|
|
95340
|
+
if (pose2.orientation) entry2.carrier.orientation = pose2.orientation;
|
|
95328
95341
|
}
|
|
95329
95342
|
function drawing(entry2, action) {
|
|
95330
95343
|
const context = engine.context;
|
|
@@ -96743,9 +96756,9 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
96743
96756
|
return { index, def: this.defs[index] };
|
|
96744
96757
|
}
|
|
96745
96758
|
/** One sprite with an explicit velocity. */
|
|
96746
|
-
spawn(kind, point,
|
|
96759
|
+
spawn(kind, point, velocity2, options) {
|
|
96747
96760
|
const { index, def } = this.kindOf(kind);
|
|
96748
|
-
(def.additive ? this.additive : this.normal).spawn(index, point,
|
|
96761
|
+
(def.additive ? this.additive : this.normal).spawn(index, point, velocity2, this.random, options);
|
|
96749
96762
|
}
|
|
96750
96763
|
/** `count` sprites leaving `point` around `normal` at about `speed` m/s. */
|
|
96751
96764
|
burst(kind, point, normal, count, speed = 1, options) {
|
|
@@ -97065,7 +97078,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
97065
97078
|
return this.particles.length;
|
|
97066
97079
|
}
|
|
97067
97080
|
spawn(options, frame2 = IDENTITY2, carried) {
|
|
97068
|
-
const
|
|
97081
|
+
const velocity2 = options.v ?? [0, 0, 0];
|
|
97069
97082
|
const world = options.wv ?? [0, 0, 0];
|
|
97070
97083
|
const particle = {
|
|
97071
97084
|
id: ++this.serial,
|
|
@@ -97092,9 +97105,9 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
97092
97105
|
opacity: options.a,
|
|
97093
97106
|
age: 0,
|
|
97094
97107
|
life: options.life,
|
|
97095
|
-
vx:
|
|
97096
|
-
vy:
|
|
97097
|
-
vz:
|
|
97108
|
+
vx: velocity2[0] + world[0],
|
|
97109
|
+
vy: velocity2[1] + world[1],
|
|
97110
|
+
vz: velocity2[2] + world[2],
|
|
97098
97111
|
spin: options.spin ?? [0, 0, 0],
|
|
97099
97112
|
gravity: options.g ?? 0,
|
|
97100
97113
|
drag: options.drag ?? 0,
|
|
@@ -97274,7 +97287,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
97274
97287
|
this.count = 0;
|
|
97275
97288
|
}
|
|
97276
97289
|
update(dt, leaveDecal) {
|
|
97277
|
-
const { position, velocity } = this;
|
|
97290
|
+
const { position, velocity: velocity2 } = this;
|
|
97278
97291
|
const confiner = this.context.confiner;
|
|
97279
97292
|
for (let index = this.count - 1; index >= 0; index--) {
|
|
97280
97293
|
this.life[index] -= dt;
|
|
@@ -97284,17 +97297,17 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
97284
97297
|
}
|
|
97285
97298
|
const offset = index * FLOATS_PER_VECTOR;
|
|
97286
97299
|
const age = 1 - this.life[index] / this.maxLife[index];
|
|
97287
|
-
|
|
97300
|
+
velocity2[offset + 1] -= this.gravity[index] * dt;
|
|
97288
97301
|
const factor = Math.max(0, 1 - this.drag[index] * dt);
|
|
97289
|
-
|
|
97290
|
-
|
|
97291
|
-
|
|
97302
|
+
velocity2[offset] *= factor;
|
|
97303
|
+
velocity2[offset + 1] *= factor;
|
|
97304
|
+
velocity2[offset + 2] *= factor;
|
|
97292
97305
|
const x0 = position[offset];
|
|
97293
97306
|
const y0 = position[offset + 1];
|
|
97294
97307
|
const z0 = position[offset + 2];
|
|
97295
|
-
position[offset] +=
|
|
97296
|
-
position[offset + 1] +=
|
|
97297
|
-
position[offset + 2] +=
|
|
97308
|
+
position[offset] += velocity2[offset] * dt;
|
|
97309
|
+
position[offset + 1] += velocity2[offset + 1] * dt;
|
|
97310
|
+
position[offset + 2] += velocity2[offset + 2] * dt;
|
|
97298
97311
|
if (this.carried && confiner && !confiner.empty && Math.abs(this.gravity[index]) < CARRIED_GRAVITY) {
|
|
97299
97312
|
const size = this.startSize[index] * (1 + (this.growth[index] - 1) * age);
|
|
97300
97313
|
if (confiner.confine(x0, y0, z0, position[offset], position[offset + 1], position[offset + 2], size * PAD_OF_SIZE3, dt)) {
|
|
@@ -97302,10 +97315,10 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
97302
97315
|
position[offset] = out.x;
|
|
97303
97316
|
position[offset + 1] = out.y;
|
|
97304
97317
|
position[offset + 2] = out.z;
|
|
97305
|
-
const [vx2, vy2, vz2] = slideAlong(out,
|
|
97306
|
-
|
|
97307
|
-
|
|
97308
|
-
|
|
97318
|
+
const [vx2, vy2, vz2] = slideAlong(out, velocity2[offset], velocity2[offset + 1], velocity2[offset + 2]);
|
|
97319
|
+
velocity2[offset] = vx2;
|
|
97320
|
+
velocity2[offset + 1] = vy2;
|
|
97321
|
+
velocity2[offset + 2] = vz2;
|
|
97309
97322
|
}
|
|
97310
97323
|
}
|
|
97311
97324
|
const mode = this.groundMode[index];
|
|
@@ -97318,9 +97331,9 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
97318
97331
|
}
|
|
97319
97332
|
if (mode === 2) {
|
|
97320
97333
|
position[offset + 1] = groundHeight + 1e-3;
|
|
97321
|
-
|
|
97322
|
-
|
|
97323
|
-
|
|
97334
|
+
velocity2[offset + 1] *= -0.3;
|
|
97335
|
+
velocity2[offset] *= 0.55;
|
|
97336
|
+
velocity2[offset + 2] *= 0.55;
|
|
97324
97337
|
}
|
|
97325
97338
|
if (mode === 3) {
|
|
97326
97339
|
if (this.context.quality.level < 2) {
|
|
@@ -97426,7 +97439,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
97426
97439
|
this.count = 0;
|
|
97427
97440
|
}
|
|
97428
97441
|
update(dt) {
|
|
97429
|
-
const { point, velocity } = this;
|
|
97442
|
+
const { point, velocity: velocity2 } = this;
|
|
97430
97443
|
for (let index = this.count - 1; index >= 0; index--) {
|
|
97431
97444
|
this.life[index] -= dt;
|
|
97432
97445
|
if (this.life[index] <= 0) {
|
|
@@ -97435,14 +97448,14 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
97435
97448
|
}
|
|
97436
97449
|
const offset = index * FLOATS_PER_VECTOR2;
|
|
97437
97450
|
const age = 1 - this.life[index] / this.maxLife[index];
|
|
97438
|
-
|
|
97451
|
+
velocity2[offset + 1] -= this.gravity[index] * dt;
|
|
97439
97452
|
const factor = Math.max(0, 1 - this.drag[index] * dt);
|
|
97440
|
-
|
|
97441
|
-
|
|
97442
|
-
|
|
97443
|
-
point[offset] +=
|
|
97444
|
-
point[offset + 1] +=
|
|
97445
|
-
point[offset + 2] +=
|
|
97453
|
+
velocity2[offset] *= factor;
|
|
97454
|
+
velocity2[offset + 1] *= factor;
|
|
97455
|
+
velocity2[offset + 2] *= factor;
|
|
97456
|
+
point[offset] += velocity2[offset] * dt;
|
|
97457
|
+
point[offset + 1] += velocity2[offset + 1] * dt;
|
|
97458
|
+
point[offset + 2] += velocity2[offset + 2] * dt;
|
|
97446
97459
|
if (this.groundMode[index]) {
|
|
97447
97460
|
const groundHeight = this.context.groundAt(point[offset], point[offset + 2]);
|
|
97448
97461
|
if (point[offset + 1] < groundHeight) {
|
|
@@ -97451,9 +97464,9 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
97451
97464
|
continue;
|
|
97452
97465
|
}
|
|
97453
97466
|
point[offset + 1] = groundHeight + 1e-3;
|
|
97454
|
-
|
|
97455
|
-
|
|
97456
|
-
|
|
97467
|
+
velocity2[offset + 1] *= -0.35;
|
|
97468
|
+
velocity2[offset] *= 0.6;
|
|
97469
|
+
velocity2[offset + 2] *= 0.6;
|
|
97457
97470
|
}
|
|
97458
97471
|
}
|
|
97459
97472
|
const length2 = this.length[index];
|
|
@@ -97462,9 +97475,9 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
97462
97475
|
this.segment[at32] = point[offset];
|
|
97463
97476
|
this.segment[at32 + 1] = point[offset + 1];
|
|
97464
97477
|
this.segment[at32 + 2] = point[offset + 2];
|
|
97465
|
-
this.segment[at32 + 3] = point[offset] -
|
|
97466
|
-
this.segment[at32 + 4] = point[offset + 1] -
|
|
97467
|
-
this.segment[at32 + 5] = point[offset + 2] -
|
|
97478
|
+
this.segment[at32 + 3] = point[offset] - velocity2[offset] * length2;
|
|
97479
|
+
this.segment[at32 + 4] = point[offset + 1] - velocity2[offset + 1] * length2;
|
|
97480
|
+
this.segment[at32 + 5] = point[offset + 2] - velocity2[offset + 2] * length2;
|
|
97468
97481
|
for (let channel = 0; channel < FLOATS_PER_VECTOR2; channel++) {
|
|
97469
97482
|
const shade3 = lerp2(this.colorStart[offset + channel], this.colorEnd[offset + channel], age) * alpha;
|
|
97470
97483
|
this.segmentColor[at32 + channel] = shade3;
|
|
@@ -97896,7 +97909,7 @@ uniform mat4 uNodes[${nodes.length}]; attribute float aNodeIndex; attribute vec3
|
|
|
97896
97909
|
return true;
|
|
97897
97910
|
},
|
|
97898
97911
|
burst: (kind, point, normal, count, speed, spriteOptions) => spriteSystem.burst(kind, point, normal, count, speed, spriteOptions),
|
|
97899
|
-
spawn: (kind, point,
|
|
97912
|
+
spawn: (kind, point, velocity2, spriteOptions) => spriteSystem.spawn(kind, point, velocity2, spriteOptions),
|
|
97900
97913
|
onLand: (owner, listener) => spriteSystem.onLand(owner, listener),
|
|
97901
97914
|
sprites: () => spriteSystem,
|
|
97902
97915
|
workshop,
|
|
@@ -98202,9 +98215,9 @@ void main(){
|
|
|
98202
98215
|
geometry.setAttribute("position", new THREE.Float32BufferAttribute([-0.5, 0, 0, 0.5, 0, 0, 0.5, 1, 0, -0.5, 1, 0], 3));
|
|
98203
98216
|
geometry.setIndex([0, 1, 2, 0, 2, 3]);
|
|
98204
98217
|
const position = new Float32Array(capacity * 3);
|
|
98205
|
-
const
|
|
98218
|
+
const velocity2 = new Float32Array(capacity * 3);
|
|
98206
98219
|
const extra = new Float32Array(capacity * 4);
|
|
98207
|
-
const attributes = [dynamic(THREE, position, 3), dynamic(THREE,
|
|
98220
|
+
const attributes = [dynamic(THREE, position, 3), dynamic(THREE, velocity2, 3), dynamic(THREE, extra, 4)];
|
|
98208
98221
|
geometry.setAttribute("aPos", attributes[0]);
|
|
98209
98222
|
geometry.setAttribute("aVel", attributes[1]);
|
|
98210
98223
|
geometry.setAttribute("aE", attributes[2]);
|
|
@@ -98222,9 +98235,9 @@ void main(){
|
|
|
98222
98235
|
position[n * 3] = s.x;
|
|
98223
98236
|
position[n * 3 + 1] = s.y;
|
|
98224
98237
|
position[n * 3 + 2] = s.z;
|
|
98225
|
-
|
|
98226
|
-
|
|
98227
|
-
|
|
98238
|
+
velocity2[n * 3] = s.vx;
|
|
98239
|
+
velocity2[n * 3 + 1] = s.vy;
|
|
98240
|
+
velocity2[n * 3 + 2] = s.vz;
|
|
98228
98241
|
extra[n * 4] = s.age;
|
|
98229
98242
|
extra[n * 4 + 1] = s.w;
|
|
98230
98243
|
extra[n * 4 + 2] = s.st;
|
|
@@ -99619,13 +99632,13 @@ vec3 c=mix(uDeep,uFoam,dome>.5?.8:.65+.35*vY);float alpha=body*vA;if(alpha<.004)
|
|
|
99619
99632
|
muzzleFlash(position, orientation, size, profile = MUZZLE_SMOKE.smokeless, track) {
|
|
99620
99633
|
if (profile.puffs <= 0 && profile.flash <= 0) return;
|
|
99621
99634
|
const follow = track ? () => {
|
|
99622
|
-
const
|
|
99623
|
-
return
|
|
99635
|
+
const pose2 = track();
|
|
99636
|
+
return pose2 ? { point: vec4(pose2.position), orientation: quaternion(pose2.orientation) } : null;
|
|
99624
99637
|
} : void 0;
|
|
99625
99638
|
sink?.play({ effect: VIEWMODEL_EFFECT_IDS.flash, point: vec4(position), direction: barrel(orientation), orientation: quaternion(orientation), seed: seed(), values: { size, ...profile }, ...follow ? { track: follow } : {} });
|
|
99626
99639
|
},
|
|
99627
|
-
smoke(position,
|
|
99628
|
-
sink?.play({ effect: VIEWMODEL_EFFECT_IDS.smoke, point: vec4(position), seed: seed(), values: { vx:
|
|
99640
|
+
smoke(position, velocity2, size, life, opacity) {
|
|
99641
|
+
sink?.play({ effect: VIEWMODEL_EFFECT_IDS.smoke, point: vec4(position), seed: seed(), values: { vx: velocity2.x, vy: velocity2.y, vz: velocity2.z, radius: size, life, opacity } });
|
|
99629
99642
|
},
|
|
99630
99643
|
backblast(rear, orientation) {
|
|
99631
99644
|
sink?.play({ effect: VIEWMODEL_EFFECT_IDS.backblast, point: vec4(rear), direction: barrel(orientation), orientation: quaternion(orientation), seed: seed() });
|
|
@@ -99789,6 +99802,85 @@ vec3 c=mix(uDeep,uFoam,dome>.5?.8:.65+.35*vY);float alpha=body*vA;if(alpha<.004)
|
|
|
99789
99802
|
return { geometry, material };
|
|
99790
99803
|
}
|
|
99791
99804
|
|
|
99805
|
+
// src/engine-loose.ts
|
|
99806
|
+
var LOOSE_ROLLING_RESISTANCE = 0.015;
|
|
99807
|
+
var CASING_FILL = 0.25;
|
|
99808
|
+
var BRASS_DENSITY = 8500;
|
|
99809
|
+
var GRENADE_MASS_KG = 0.4;
|
|
99810
|
+
var LOOSE_USER = { casing: 100, grenade: 2 };
|
|
99811
|
+
var BOUNCE_FALL_SPEED = 0.5;
|
|
99812
|
+
var BOUNCE_RISE_SPEED = 0.2;
|
|
99813
|
+
var QUARTER_TURN_Z = [0, 0, Math.SQRT1_2, Math.SQRT1_2];
|
|
99814
|
+
var CASING_MATERIAL = { frictionStatic: 0.4, frictionDynamic: 0.3, restitution: 0.4 };
|
|
99815
|
+
var GRENADE_MATERIAL = { frictionStatic: 0.6, frictionDynamic: 0.5, restitution: 0.35 };
|
|
99816
|
+
function casingCollider(radius, length2) {
|
|
99817
|
+
return {
|
|
99818
|
+
shape: { kind: "compound", children: [{ shape: { kind: "cylinder", halfHeight: length2 / 2, radius }, position: [0, 0, 0], rotation: QUARTER_TURN_Z }] },
|
|
99819
|
+
mass: Math.PI * radius * radius * length2 * BRASS_DENSITY * CASING_FILL,
|
|
99820
|
+
material: CASING_MATERIAL,
|
|
99821
|
+
rolling: { coefficient: LOOSE_ROLLING_RESISTANCE, radius },
|
|
99822
|
+
user: LOOSE_USER.casing
|
|
99823
|
+
};
|
|
99824
|
+
}
|
|
99825
|
+
function explosiveCollider(THREE, explosive) {
|
|
99826
|
+
if (explosive !== "m67") return void 0;
|
|
99827
|
+
const model = buildExplosiveModel(THREE, explosive);
|
|
99828
|
+
if (!model) return void 0;
|
|
99829
|
+
const centre = new THREE.Box3().setFromObject(model).getCenter(new THREE.Vector3());
|
|
99830
|
+
const { bodyRadius, fuze, spoon } = M67_PARTS;
|
|
99831
|
+
const at4 = (x, y) => [x - centre.x, y + bodyRadius - centre.y, 0 - centre.z];
|
|
99832
|
+
return {
|
|
99833
|
+
shape: {
|
|
99834
|
+
kind: "compound",
|
|
99835
|
+
children: [
|
|
99836
|
+
{ shape: { kind: "sphere", radius: bodyRadius }, position: at4(0, 0) },
|
|
99837
|
+
{ shape: { kind: "cylinder", halfHeight: fuze.height / 2, radius: fuze.radius }, position: at4(0, fuze.y) },
|
|
99838
|
+
{ shape: { kind: "box", half: [spoon.size[0] / 2, spoon.size[1] / 2, spoon.size[2] / 2] }, position: at4(spoon.x, spoon.y), rotation: [0, 0, Math.sin(spoon.tilt / 2), Math.cos(spoon.tilt / 2)] }
|
|
99839
|
+
]
|
|
99840
|
+
},
|
|
99841
|
+
mass: GRENADE_MASS_KG,
|
|
99842
|
+
material: GRENADE_MATERIAL,
|
|
99843
|
+
rolling: { coefficient: LOOSE_ROLLING_RESISTANCE, radius: bodyRadius },
|
|
99844
|
+
user: LOOSE_USER.grenade
|
|
99845
|
+
};
|
|
99846
|
+
}
|
|
99847
|
+
function spawnLoose(world, collider, launch) {
|
|
99848
|
+
const desc = {
|
|
99849
|
+
shape: collider.shape,
|
|
99850
|
+
motion: "dynamic",
|
|
99851
|
+
mass: collider.mass,
|
|
99852
|
+
position: [launch.position.x, launch.position.y, launch.position.z],
|
|
99853
|
+
rotation: [launch.rotation.x, launch.rotation.y, launch.rotation.z, launch.rotation.w],
|
|
99854
|
+
material: collider.material,
|
|
99855
|
+
layer: "debris",
|
|
99856
|
+
continuous: true,
|
|
99857
|
+
rolling: collider.rolling,
|
|
99858
|
+
linearVelocity: [launch.velocity.x, launch.velocity.y, launch.velocity.z],
|
|
99859
|
+
angularVelocity: [launch.spin.x, launch.spin.y, launch.spin.z],
|
|
99860
|
+
user: collider.user
|
|
99861
|
+
};
|
|
99862
|
+
return { id: world.createBody(desc), bounces: 0, fallSpeed: 0 };
|
|
99863
|
+
}
|
|
99864
|
+
var scratchReading = { asleep: false, bounceSpeed: void 0 };
|
|
99865
|
+
var pose = new Float64Array(7);
|
|
99866
|
+
var velocity = new Float64Array(6);
|
|
99867
|
+
function syncLoose(world, body, object2) {
|
|
99868
|
+
world.readPose(body.id, pose, 0);
|
|
99869
|
+
world.readVelocity(body.id, velocity, 0);
|
|
99870
|
+
object2.position.set(pose[0] ?? 0, pose[1] ?? 0, pose[2] ?? 0);
|
|
99871
|
+
object2.quaternion.set(pose[3] ?? 0, pose[4] ?? 0, pose[5] ?? 0, pose[6] ?? 1);
|
|
99872
|
+
const vertical = velocity[1] ?? 0;
|
|
99873
|
+
const bounced = body.fallSpeed > BOUNCE_FALL_SPEED && vertical > BOUNCE_RISE_SPEED;
|
|
99874
|
+
scratchReading.bounceSpeed = bounced ? body.fallSpeed : void 0;
|
|
99875
|
+
body.fallSpeed = vertical < 0 ? -vertical : 0;
|
|
99876
|
+
if (bounced) body.bounces++;
|
|
99877
|
+
scratchReading.asleep = world.isSleeping(body.id);
|
|
99878
|
+
return scratchReading;
|
|
99879
|
+
}
|
|
99880
|
+
function dropLoose(world, body) {
|
|
99881
|
+
world.removeBody(body.id);
|
|
99882
|
+
}
|
|
99883
|
+
|
|
99792
99884
|
// src/fx/particles.ts
|
|
99793
99885
|
var MAX_PARTICLES = 900;
|
|
99794
99886
|
var FLOOR_FRICTION = 0.45;
|
|
@@ -99803,7 +99895,7 @@ vec3 c=mix(uDeep,uFoam,dome>.5?.8:.65+.35*vY);float alpha=body*vA;if(alpha<.004)
|
|
|
99803
99895
|
if (mesh3.isMesh) mesh3.geometry.dispose();
|
|
99804
99896
|
});
|
|
99805
99897
|
};
|
|
99806
|
-
function createParticles(THREE, scene, groundAt, limit, surface) {
|
|
99898
|
+
function createParticles(THREE, scene, groundAt, limit, surface, physics) {
|
|
99807
99899
|
const from = new THREE.Vector3();
|
|
99808
99900
|
const step = new THREE.Vector3();
|
|
99809
99901
|
let list2 = [];
|
|
@@ -99813,6 +99905,7 @@ vec3 c=mix(uDeep,uFoam,dome>.5?.8:.65+.35*vY);float alpha=body*vA;if(alpha<.004)
|
|
|
99813
99905
|
});
|
|
99814
99906
|
particle.object.removeFromParent();
|
|
99815
99907
|
if (particle.ownsGeometry) disposeOwned(particle.object);
|
|
99908
|
+
if (particle.body && physics) dropLoose(physics, particle.body);
|
|
99816
99909
|
particle.onRemove?.();
|
|
99817
99910
|
if (particle.fadeFrom !== void 0) particle.object.material.dispose();
|
|
99818
99911
|
list2 = list2.filter((other) => other !== particle);
|
|
@@ -99828,24 +99921,24 @@ vec3 c=mix(uDeep,uFoam,dome>.5?.8:.65+.35*vY);float alpha=body*vA;if(alpha<.004)
|
|
|
99828
99921
|
if (!hit) return;
|
|
99829
99922
|
const at4 = origin.y + travel.y * hit.distance;
|
|
99830
99923
|
if (at4 <= groundAt(origin.x + travel.x * hit.distance, origin.z + travel.z * hit.distance) + radius + FLOOR_EPSILON) return;
|
|
99831
|
-
const { velocity } = particle;
|
|
99832
|
-
const impact3 = Math.abs(
|
|
99924
|
+
const { velocity: velocity2 } = particle;
|
|
99925
|
+
const impact3 = Math.abs(velocity2.dot(hit.normal));
|
|
99833
99926
|
object2.position.copy(origin).addScaledVector(travel, Math.max(0, hit.distance - radius));
|
|
99834
|
-
|
|
99835
|
-
|
|
99927
|
+
velocity2.addScaledVector(hit.normal, -(1 + particle.bounce) * velocity2.dot(hit.normal));
|
|
99928
|
+
velocity2.multiplyScalar(FLOOR_FRICTION);
|
|
99836
99929
|
particle.spin.multiplyScalar(FLOOR_FRICTION);
|
|
99837
99930
|
if (particle.bounces < 4) api.onBounce?.(particle.kind, { object: object2, speed: impact3, bounce: particle.bounces });
|
|
99838
99931
|
particle.bounces++;
|
|
99839
99932
|
};
|
|
99840
99933
|
const api = {
|
|
99841
|
-
spawn(object2,
|
|
99934
|
+
spawn(object2, velocity2, options = {}) {
|
|
99842
99935
|
object2.traverse((node) => {
|
|
99843
99936
|
node.userData[PARTICLE_USERDATA_KEY] = true;
|
|
99844
99937
|
});
|
|
99845
99938
|
scene.add(object2);
|
|
99846
99939
|
list2.push({
|
|
99847
99940
|
object: object2,
|
|
99848
|
-
velocity,
|
|
99941
|
+
velocity: velocity2,
|
|
99849
99942
|
spin: options.spin ?? new THREE.Vector3(),
|
|
99850
99943
|
age: 0,
|
|
99851
99944
|
resting: false,
|
|
@@ -99861,7 +99954,8 @@ vec3 c=mix(uDeep,uFoam,dome>.5?.8:.65+.35*vY);float alpha=body*vA;if(alpha<.004)
|
|
|
99861
99954
|
onGround: options.onGround,
|
|
99862
99955
|
ownsGeometry: options.ownsGeometry ?? false,
|
|
99863
99956
|
onRemove: options.onRemove,
|
|
99864
|
-
bounces: 0
|
|
99957
|
+
bounces: 0,
|
|
99958
|
+
body: options.collider && physics ? spawnLoose(physics, options.collider, { position: object2.position, rotation: object2.quaternion, velocity: velocity2, spin: options.spin ?? new THREE.Vector3() }) : void 0
|
|
99865
99959
|
});
|
|
99866
99960
|
const hostLimit = limit?.();
|
|
99867
99961
|
const oldest = list2[0];
|
|
@@ -99878,6 +99972,13 @@ vec3 c=mix(uDeep,uFoam,dome>.5?.8:.65+.35*vY);float alpha=body*vA;if(alpha<.004)
|
|
|
99878
99972
|
const { object: object2 } = particle;
|
|
99879
99973
|
if (particle.fadeFrom !== void 0) object2.material.opacity = Math.max(0, particle.fadeFrom * (1 - particle.age / particle.life));
|
|
99880
99974
|
if (particle.resting) continue;
|
|
99975
|
+
if (particle.body && physics) {
|
|
99976
|
+
const reading = syncLoose(physics, particle.body, object2);
|
|
99977
|
+
if (reading.bounceSpeed !== void 0 && particle.bounces < 4) api.onBounce?.(particle.kind, { object: object2, speed: reading.bounceSpeed, bounce: particle.bounces });
|
|
99978
|
+
if (reading.bounceSpeed !== void 0) particle.bounces++;
|
|
99979
|
+
if (reading.asleep) particle.resting = true;
|
|
99980
|
+
continue;
|
|
99981
|
+
}
|
|
99881
99982
|
particle.velocity.y -= particle.gravity * dt;
|
|
99882
99983
|
if (particle.drag) particle.velocity.multiplyScalar(Math.max(0, 1 - particle.drag * dt));
|
|
99883
99984
|
const probed = surface !== void 0 && SOLID_KINDS.has(particle.kind) && probes < MAX_PROBES_PER_FRAME && particle.velocity.lengthSq() > PROBE_MIN_SPEED * PROBE_MIN_SPEED;
|
|
@@ -99926,20 +100027,20 @@ vec3 c=mix(uDeep,uFoam,dome>.5?.8:.65+.35*vY);float alpha=body*vA;if(alpha<.004)
|
|
|
99926
100027
|
const registry = partRegistry(model.parts);
|
|
99927
100028
|
const rest2 = /* @__PURE__ */ new Map();
|
|
99928
100029
|
for (const part of [...registry.values(), model.root]) rest2.set(part, { position: part.position.clone(), rotation: part.rotation.clone() });
|
|
99929
|
-
const apply = (object2,
|
|
100030
|
+
const apply = (object2, pose2) => {
|
|
99930
100031
|
const base = rest2.get(object2);
|
|
99931
100032
|
if (!base) return;
|
|
99932
|
-
const [dx, dy, dz] =
|
|
99933
|
-
const [rx, ry, rz] =
|
|
100033
|
+
const [dx, dy, dz] = pose2.position ?? [0, 0, 0];
|
|
100034
|
+
const [rx, ry, rz] = pose2.rotation ?? [0, 0, 0];
|
|
99934
100035
|
object2.position.set(base.position.x + dx, base.position.y + dy, base.position.z + dz);
|
|
99935
100036
|
object2.rotation.set(base.rotation.x + rx, base.rotation.y + ry, base.rotation.z + rz);
|
|
99936
100037
|
};
|
|
99937
100038
|
return {
|
|
99938
|
-
setPartPose(partId,
|
|
100039
|
+
setPartPose(partId, pose2) {
|
|
99939
100040
|
const part = registry.get(partId);
|
|
99940
|
-
if (part) apply(part,
|
|
100041
|
+
if (part) apply(part, pose2);
|
|
99941
100042
|
},
|
|
99942
|
-
setRootPose: (
|
|
100043
|
+
setRootPose: (pose2) => apply(model.root, pose2)
|
|
99943
100044
|
};
|
|
99944
100045
|
}
|
|
99945
100046
|
|
|
@@ -99968,13 +100069,13 @@ vec3 c=mix(uDeep,uFoam,dome>.5?.8:.65+.35*vY);float alpha=body*vA;if(alpha<.004)
|
|
|
99968
100069
|
const vector2 = (x, y, z) => new THREE.Vector3(x, y, z);
|
|
99969
100070
|
const positionOf3 = (part) => worldPositionOf(session, part, new THREE.Vector3());
|
|
99970
100071
|
const reach2 = Math.max(0.55, Math.min(1.2, session.lengthMetres));
|
|
99971
|
-
const throwCase = (mark,
|
|
100072
|
+
const throwCase = (mark, velocity2, spin, tilt = 0) => {
|
|
99972
100073
|
if (!session.cartridge || !world.layers.casings) return;
|
|
99973
100074
|
const casing2 = buildCasing(kit, session.cartridge.dims, session.cartridge.shape);
|
|
99974
100075
|
casing2.group.position.copy(positionOf3(mark));
|
|
99975
100076
|
casing2.group.rotation.set(0, random() * 0.6 - 0.3, tilt);
|
|
99976
100077
|
if (session.cartridge.caseType) casing2.group.userData["caseType"] = session.cartridge.caseType;
|
|
99977
|
-
particles.spawn(casing2.group,
|
|
100078
|
+
particles.spawn(casing2.group, velocity2, { kind: "casing", life: 25, radius: casing2.radius, bounce: 0.35, spin, onRest: restFlat, ownsGeometry: true, collider: casingCollider(casing2.radius, casing2.length) });
|
|
99978
100079
|
};
|
|
99979
100080
|
const ejectFromPort = (down2) => {
|
|
99980
100081
|
if (!parts2.eject) return;
|
|
@@ -99983,8 +100084,8 @@ vec3 c=mix(uDeep,uFoam,dome>.5?.8:.65+.35*vY);float alpha=body*vA;if(alpha<.004)
|
|
|
99983
100084
|
};
|
|
99984
100085
|
const ejectAll = (marks, spent) => {
|
|
99985
100086
|
marks?.forEach((mark, index) => {
|
|
99986
|
-
const { velocity, spin, tilt } = spent(index);
|
|
99987
|
-
throwCase(mark, toWorld3(session,
|
|
100087
|
+
const { velocity: velocity2, spin, tilt } = spent(index);
|
|
100088
|
+
throwCase(mark, toWorld3(session, velocity2), spin, tilt);
|
|
99988
100089
|
});
|
|
99989
100090
|
};
|
|
99990
100091
|
const moveIn = (from, to, tilt) => {
|
|
@@ -100633,11 +100734,11 @@ vec3 c=mix(uDeep,uFoam,dome>.5?.8:.65+.35*vY);float alpha=body*vA;if(alpha<.004)
|
|
|
100633
100734
|
const random = createRng(options.seed ?? 1);
|
|
100634
100735
|
const layers = options.layers ?? createLayers();
|
|
100635
100736
|
const distance4 = () => options.soundDistance?.() ?? 0;
|
|
100636
|
-
const particles = createParticles(THREE, scene, groundAt, options.particleLimit, createSurfaceRaycast(THREE, scene));
|
|
100737
|
+
const particles = createParticles(THREE, scene, groundAt, options.particleLimit, createSurfaceRaycast(THREE, scene), options.physics);
|
|
100637
100738
|
const spawnParticle = particles.spawn.bind(particles);
|
|
100638
|
-
particles.spawn = (object2,
|
|
100739
|
+
particles.spawn = (object2, velocity2, particleOptions) => {
|
|
100639
100740
|
if (lens2) toWorldLens(camera2, object2.position, worldFovOf(), lens2.fov);
|
|
100640
|
-
spawnParticle(object2,
|
|
100741
|
+
spawnParticle(object2, velocity2, particleOptions);
|
|
100641
100742
|
};
|
|
100642
100743
|
particles.onBounce = (kind, hit) => {
|
|
100643
100744
|
if (!audio || kind !== "casing" && kind !== "magazine") return;
|
|
@@ -100662,10 +100763,10 @@ vec3 c=mix(uDeep,uFoam,dome>.5?.8:.65+.35*vY);float alpha=body*vA;if(alpha<.004)
|
|
|
100662
100763
|
stop: (handle) => worldSink.stop(handle)
|
|
100663
100764
|
} : void 0;
|
|
100664
100765
|
const effects = createEffects(THREE, lensSink, random);
|
|
100665
|
-
function seenThroughLens(
|
|
100666
|
-
if (!
|
|
100667
|
-
const at4 = toWorldLens(camera2, trackPoint.set(...
|
|
100668
|
-
return { ...
|
|
100766
|
+
function seenThroughLens(pose2) {
|
|
100767
|
+
if (!pose2 || !lens2) return pose2;
|
|
100768
|
+
const at4 = toWorldLens(camera2, trackPoint.set(...pose2.point), worldFovOf(), lens2.fov);
|
|
100769
|
+
return { ...pose2, point: [at4.x, at4.y, at4.z] };
|
|
100669
100770
|
}
|
|
100670
100771
|
const hand = new THREE.Group();
|
|
100671
100772
|
hand.name = VIEWMODEL_NODE_NAME;
|
|
@@ -100891,9 +100992,9 @@ vec3 c=mix(uDeep,uFoam,dome>.5?.8:.65+.35*vY);float alpha=body*vA;if(alpha<.004)
|
|
|
100891
100992
|
eyeTurn.copy(camera2.quaternion).invert();
|
|
100892
100993
|
const rest2 = targetsOf(THREE, held, session.model.root.getWorldQuaternion(rootQuaternion), 0);
|
|
100893
100994
|
let needed = 0;
|
|
100894
|
-
for (const [anchor,
|
|
100895
|
-
if (!anchor || !
|
|
100896
|
-
seen.set(...
|
|
100995
|
+
for (const [anchor, pose2] of [[held.right, rest2.R], [held.left, rest2.L]]) {
|
|
100996
|
+
if (!anchor || !pose2 || anchor.part !== session.model.root) continue;
|
|
100997
|
+
seen.set(...pose2.position).sub(camera2.position).applyQuaternion(eyeTurn);
|
|
100897
100998
|
if (-seen.z > 0.05) needed = Math.max(needed, HAND_IN_VIEW.floor * -seen.z * tanHalf - seen.y);
|
|
100898
100999
|
}
|
|
100899
101000
|
return Math.max(0, Math.min(HAND_IN_VIEW.max, needed));
|
|
@@ -101144,6 +101245,7 @@ vec3 c=mix(uDeep,uFoam,dome>.5?.8:.65+.35*vY);float alpha=body*vA;if(alpha<.004)
|
|
|
101144
101245
|
...options.condition ? { condition: options.condition } : {},
|
|
101145
101246
|
...options.attachmentModels ? { attachmentModels: options.attachmentModels } : {},
|
|
101146
101247
|
...options.raycast ? { raycast: options.raycast } : {},
|
|
101248
|
+
...options.physics ? { physics: options.physics } : {},
|
|
101147
101249
|
...options.contact ? { contact: options.contact } : {},
|
|
101148
101250
|
...options.bodyHold ? { bodyHold: options.bodyHold } : {},
|
|
101149
101251
|
...options.firstPerson ? { firstPerson: options.firstPerson } : {},
|
|
@@ -101384,7 +101486,7 @@ vec3 c=mix(uDeep,uFoam,dome>.5?.8:.65+.35*vY);float alpha=body*vA;if(alpha<.004)
|
|
|
101384
101486
|
const rigs = /* @__PURE__ */ new Map();
|
|
101385
101487
|
const away = /* @__PURE__ */ new Map();
|
|
101386
101488
|
const strapMaterial = new THREE.MeshStandardMaterial({ color: SLING_HANG.color, roughness: 0.85, metalness: 0 });
|
|
101387
|
-
const frameOf2 = (
|
|
101489
|
+
const frameOf2 = (pose2) => ({ position: new THREE.Vector3(...pose2.position), quaternion: new THREE.Quaternion(...pose2.quaternion) });
|
|
101388
101490
|
const scratch3 = { position: new THREE.Vector3(), quaternion: new THREE.Quaternion(), inverse: new THREE.Quaternion(), acceleration: new THREE.Vector3(), velocity: new THREE.Vector3() };
|
|
101389
101491
|
const holderOnHand = (rig, hand) => {
|
|
101390
101492
|
const quaternion2 = hand.quaternion.clone().multiply(rig.grip.quaternion.clone().invert());
|
|
@@ -101396,8 +101498,8 @@ vec3 c=mix(uDeep,uFoam,dome>.5?.8:.65+.35*vY);float alpha=body*vA;if(alpha<.004)
|
|
|
101396
101498
|
};
|
|
101397
101499
|
const inFrame = (local2, base) => ({ position: local2.position.clone().applyQuaternion(base.quaternion).add(base.position), quaternion: base.quaternion.clone().multiply(local2.quaternion) });
|
|
101398
101500
|
const holdFrame = () => {
|
|
101399
|
-
const
|
|
101400
|
-
return
|
|
101501
|
+
const pose2 = options.holdFrame?.();
|
|
101502
|
+
return pose2 ? frameOf2(pose2) : null;
|
|
101401
101503
|
};
|
|
101402
101504
|
const goal = (entry2) => {
|
|
101403
101505
|
if (entry2.motion?.kind === "toss") {
|
|
@@ -101410,9 +101512,9 @@ vec3 c=mix(uDeep,uFoam,dome>.5?.8:.65+.35*vY);float alpha=body*vA;if(alpha<.004)
|
|
|
101410
101512
|
const base = holdFrame();
|
|
101411
101513
|
return base && entry2.taken ? inFrame(entry2.taken, base) : null;
|
|
101412
101514
|
}
|
|
101413
|
-
const
|
|
101414
|
-
if (!
|
|
101415
|
-
return entry2.swing ? hanging(entry2, frameOf2(
|
|
101515
|
+
const pose2 = options.bodySlot(entry2.slot);
|
|
101516
|
+
if (!pose2) return null;
|
|
101517
|
+
return entry2.swing ? hanging(entry2, frameOf2(pose2)) : frameOf2(pose2);
|
|
101416
101518
|
};
|
|
101417
101519
|
const hanging = (entry2, frame2) => {
|
|
101418
101520
|
const forward = new THREE.Vector3(0, 0, 1).applyQuaternion(frame2.quaternion);
|
|
@@ -101430,11 +101532,11 @@ vec3 c=mix(uDeep,uFoam,dome>.5?.8:.65+.35*vY);float alpha=body*vA;if(alpha<.004)
|
|
|
101430
101532
|
};
|
|
101431
101533
|
const swingOf = (entry2, frame2, dt) => {
|
|
101432
101534
|
if (!entry2.swing || dt <= 0) return;
|
|
101433
|
-
const { velocity, acceleration, inverse } = scratch3;
|
|
101434
|
-
|
|
101435
|
-
acceleration.copy(
|
|
101535
|
+
const { velocity: velocity2, acceleration, inverse } = scratch3;
|
|
101536
|
+
velocity2.copy(frame2.position).sub(entry2.last ?? frame2.position).divideScalar(dt);
|
|
101537
|
+
acceleration.copy(velocity2).sub(entry2.last ? entry2.speed : velocity2).divideScalar(dt).clampLength(0, MAX_SWING_ACCELERATION);
|
|
101436
101538
|
entry2.last = (entry2.last ?? new THREE.Vector3()).copy(frame2.position);
|
|
101437
|
-
entry2.speed.copy(
|
|
101539
|
+
entry2.speed.copy(velocity2);
|
|
101438
101540
|
acceleration.applyQuaternion(inverse.copy(frame2.quaternion).invert());
|
|
101439
101541
|
const state = entry2.swing.step(dt, [-acceleration.x, acceleration.y, acceleration.z]);
|
|
101440
101542
|
entry2.rig.swing.rotation.set(-(state.forward + Math.max(0, -entry2.lean)), 0, -state.side);
|