@adatechnology/game-characters-three 0.11.0 → 0.11.2
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/index.global.js +55 -3
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +52 -2
- package/dist/index.js.map +1 -1
- package/package.json +5 -5
package/dist/index.global.js
CHANGED
|
@@ -8577,7 +8577,7 @@ ${accessoryHead}`).replace("{ vec3 _nn = objectNormal; bodyAnim(position, _nn);"
|
|
|
8577
8577
|
};
|
|
8578
8578
|
};
|
|
8579
8579
|
|
|
8580
|
-
// ../game-audio/dist/chunk-
|
|
8580
|
+
// ../game-audio/dist/chunk-BUYBYP4L.js
|
|
8581
8581
|
var DISTANCE_CURVES = {
|
|
8582
8582
|
/** The game's `sfx`: `vol / (1 + d² × 0.004)`, cutoff `/ (1 + d × 0.01)`, silent below 0.01 (jogo L62091–62092, L62101). */
|
|
8583
8583
|
game_sfx: { model: "inverse_square", k: 4e-3, cutoffK: 0.01, minGain: 0.01 },
|
|
@@ -8755,6 +8755,8 @@ ${accessoryHead}`).replace("{ vec3 _nn = objectNormal; bodyAnim(position, _nn);"
|
|
|
8755
8755
|
["revolver_38_357", 2, "sfx_pistol"],
|
|
8756
8756
|
["revolver_44_50ae", 3, "sfx_pistol"],
|
|
8757
8757
|
["smg_9mm_auto", 1, "sfx_pistol"],
|
|
8758
|
+
["launcher_40mm", 2],
|
|
8759
|
+
["rocket_launch", 2],
|
|
8758
8760
|
["shotgun_12", 1, "sfx_shotgun"],
|
|
8759
8761
|
["rifle_5_56", 1, "sfx_rifle"],
|
|
8760
8762
|
["rifle_7_62x39", 1, "sfx_rifle"],
|
|
@@ -11504,16 +11506,62 @@ ${accessoryHead}`).replace("{ vec3 _nn = objectNormal; bodyAnim(position, _nn);"
|
|
|
11504
11506
|
};
|
|
11505
11507
|
};
|
|
11506
11508
|
|
|
11507
|
-
// src/player/
|
|
11509
|
+
// src/player/eye-clip.ts
|
|
11508
11510
|
var isDrawable = (object2) => {
|
|
11509
11511
|
const flagged = object2;
|
|
11510
11512
|
return Boolean(flagged.isMesh || flagged.isSprite || flagged.isPoints);
|
|
11511
11513
|
};
|
|
11514
|
+
var createEyeClip = (THREE, options) => {
|
|
11515
|
+
let isCutting = false;
|
|
11516
|
+
let viewCamera = null;
|
|
11517
|
+
const plane2 = new THREE.Plane();
|
|
11518
|
+
const planes = [plane2];
|
|
11519
|
+
const eyeAt = new THREE.Vector3();
|
|
11520
|
+
const front = new THREE.Vector3();
|
|
11521
|
+
const place = () => {
|
|
11522
|
+
options.eye.getWorldPosition(eyeAt);
|
|
11523
|
+
front.set(0, 0, 1).transformDirection(options.front.matrixWorld);
|
|
11524
|
+
plane2.setFromNormalAndCoplanarPoint(front, eyeAt.addScaledVector(front, -options.behind));
|
|
11525
|
+
};
|
|
11526
|
+
const drawables = [];
|
|
11527
|
+
for (const root of options.roots) root.traverse((object2) => isDrawable(object2) && drawables.push(object2));
|
|
11528
|
+
for (const drawable of drawables) {
|
|
11529
|
+
const previousBefore = drawable.onBeforeRender;
|
|
11530
|
+
const previousAfter = drawable.onAfterRender;
|
|
11531
|
+
let saved = [];
|
|
11532
|
+
drawable.onBeforeRender = (renderer, scene2, camera, geometry, material, group) => {
|
|
11533
|
+
previousBefore.call(drawable, renderer, scene2, camera, geometry, material, group);
|
|
11534
|
+
if (!isCutting || camera !== viewCamera) return;
|
|
11535
|
+
renderer.localClippingEnabled = true;
|
|
11536
|
+
place();
|
|
11537
|
+
const drawn = Array.isArray(drawable.material) ? drawable.material : [material];
|
|
11538
|
+
saved = drawn.map((entry) => ({ material: entry, planes: entry.clippingPlanes }));
|
|
11539
|
+
for (const entry of drawn) entry.clippingPlanes = planes;
|
|
11540
|
+
};
|
|
11541
|
+
drawable.onAfterRender = (renderer, scene2, camera, geometry, material, group) => {
|
|
11542
|
+
previousAfter.call(drawable, renderer, scene2, camera, geometry, material, group);
|
|
11543
|
+
for (const entry of saved) entry.material.clippingPlanes = entry.planes;
|
|
11544
|
+
saved = [];
|
|
11545
|
+
};
|
|
11546
|
+
}
|
|
11547
|
+
return {
|
|
11548
|
+
setView(mode, camera) {
|
|
11549
|
+
isCutting = mode === "first" && camera !== null;
|
|
11550
|
+
viewCamera = camera;
|
|
11551
|
+
}
|
|
11552
|
+
};
|
|
11553
|
+
};
|
|
11554
|
+
|
|
11555
|
+
// src/player/head-hiding.ts
|
|
11556
|
+
var isDrawable2 = (object2) => {
|
|
11557
|
+
const flagged = object2;
|
|
11558
|
+
return Boolean(flagged.isMesh || flagged.isSprite || flagged.isPoints);
|
|
11559
|
+
};
|
|
11512
11560
|
var createHeadHider = (roots) => {
|
|
11513
11561
|
let isHiding = false;
|
|
11514
11562
|
let viewCamera = null;
|
|
11515
11563
|
const drawables = [];
|
|
11516
|
-
for (const root of roots) root.traverse((object2) =>
|
|
11564
|
+
for (const root of roots) root.traverse((object2) => isDrawable2(object2) && drawables.push(object2));
|
|
11517
11565
|
for (const drawable of drawables) {
|
|
11518
11566
|
const previousBefore = drawable.onBeforeRender;
|
|
11519
11567
|
const previousAfter = drawable.onAfterRender;
|
|
@@ -11552,6 +11600,7 @@ ${accessoryHead}`).replace("{ vec3 _nn = objectNormal; bodyAnim(position, _nn);"
|
|
|
11552
11600
|
var CLIP_CASCADE = 5;
|
|
11553
11601
|
var FALL_SECONDS2 = 0.3;
|
|
11554
11602
|
var BUILDER_EYE = [0, 1.815, 0.16];
|
|
11603
|
+
var EYE_CLIP_BEHIND = 0;
|
|
11555
11604
|
var EYE_OFFSET = [0, -0.068, 0];
|
|
11556
11605
|
var EYE_BOB = 0.5;
|
|
11557
11606
|
var HIP_HEIGHT = 0.95;
|
|
@@ -11665,6 +11714,8 @@ ${accessoryHead}`).replace("{ vec3 _nn = objectNormal; bodyAnim(position, _nn);"
|
|
|
11665
11714
|
rig.headG.children[0].add(eyeSocket);
|
|
11666
11715
|
const headHider = createHeadHider([rig.headG, ...rig.neck ? [rig.neck] : []]);
|
|
11667
11716
|
const armsHider = createHeadHider(rig.arms.map((arm) => arm.g));
|
|
11717
|
+
const hips = rig.fig.children.filter((child) => child.isMesh);
|
|
11718
|
+
const eyeClip = createEyeClip(THREE, { roots: [rig.upper, ...hips], eye: eyeSocket, front: rig.upper, behind: EYE_CLIP_BEHIND });
|
|
11668
11719
|
const eyeLocal = new THREE.Vector3();
|
|
11669
11720
|
let bob = 0;
|
|
11670
11721
|
let hipWithoutBob = null;
|
|
@@ -12014,6 +12065,7 @@ ${accessoryHead}`).replace("{ vec3 _nn = objectNormal; bodyAnim(position, _nn);"
|
|
|
12014
12065
|
},
|
|
12015
12066
|
setView: (mode, camera, viewOptions) => {
|
|
12016
12067
|
headHider.setView(mode, camera);
|
|
12068
|
+
eyeClip.setView(mode, camera);
|
|
12017
12069
|
armsHider.setView(viewOptions?.arms ? mode : "third", camera);
|
|
12018
12070
|
},
|
|
12019
12071
|
play(clip, playOptions = {}) {
|