@adatechnology/game-characters-three 0.9.6 → 0.11.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/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { T as Three, B as BestSpec, a as BestPose, P as PersonSpec, b as PersonCharacter, c as PersonGroupSpec, L as LegRig, A as ArmRig, d as PersonExtra, R as RichRig, e as BloodLook, F as FluidsBridge, C as CharacterSound, f as AvatarItemUsePose, g as AvatarViewMode, h as
|
|
2
|
-
export {
|
|
1
|
+
import { T as Three, B as BestSpec, a as BestPose, P as PersonSpec, b as PersonCharacter, c as PersonGroupSpec, L as LegRig, A as ArmRig, d as PersonExtra, R as RichRig, e as BloodLook, F as FluidsBridge, C as CharacterSound, f as AvatarItemUsePose, g as AvatarViewMode, h as AvatarViewOptions, i as ReachView, j as PlayerAvatar } from './testing-7EIhFq92.js';
|
|
2
|
+
export { k as AVATAR_AREA_ID, l as AreaContext, m as AvatarEvent, n as AvatarTestOptions, o as AvatarUpdate, p as BODY_MATERIAL_DEF, q as BODY_SOUNDS, r as BloodAge, s as BloodLookOptions, t as BloodSink, u as BodySegment, v as BodySoundRule, w as CHARACTERS_AREA_ID, x as CharacterSoundOptions, y as CharacterSoundSink, z as CharacterSoundStyle, D as CharactersTestOptions, E as FilmSink, G as FluidsBridgeOptions, H as HIT_PRESETS, I as HitPreset, J as PERSON_ITEM_PREFIX, K as PLAYER_SOUNDS, M as PlayPoseOptions, N as PlayerAvatarColors, O as PlayerAvatarOptions, Q as PlayerAvatarSpec, S as PoseTargets, U as ProfessionCard, V as RigAnimator, W as RigAnimatorOptions, X as UNDEAD_VOICES, Y as UNDEAD_VOICE_SOURCES, Z as UndeadCard, _ as UndeadLike, $ as UndeadVoice, a0 as VoiceMoment, a1 as VoiceStep, a2 as WoundSpray, a3 as ZOMBIE_ITEM_PREFIX, a4 as bloodLookOfAge, a5 as createAvatarTestModule, a6 as createCharacterSound, a7 as createCharactersTestModule, a8 as createFluidsBridge, a9 as createPlayerAvatar, aa as createRigAnimator, ab as personSpecOf, ac as registerBodyMaterial } from './testing-7EIhFq92.js';
|
|
3
3
|
import { BodySpec, SegmentId, PoseClip, PoseClipEvent, FirstPersonClip } from '@adatechnology/game-characters';
|
|
4
4
|
import * as THREE_NS from 'three';
|
|
5
5
|
import { LightBudget, SourceHandle } from '@adatechnology/game-render-three';
|
|
@@ -989,8 +989,8 @@ type RoomAvatarLike = {
|
|
|
989
989
|
shoulder(side: 'R' | 'L'): THREE_NS.Object3D;
|
|
990
990
|
/** Where the body's eyes are after its pose (`RoomAvatar.eye`): the room draws the body in both views and puts the first-person camera there. */
|
|
991
991
|
eye(out?: THREE_NS.Vector3): THREE_NS.Vector3;
|
|
992
|
-
/** Hides the head and neck from `camera` in first person (`RoomAvatar.setView`). */
|
|
993
|
-
setView(mode: AvatarViewMode, camera: THREE_NS.Object3D | null): void;
|
|
992
|
+
/** Hides the head and neck from `camera` in first person, and the arms with `arms` (`RoomAvatar.setView`). */
|
|
993
|
+
setView(mode: AvatarViewMode, camera: THREE_NS.Object3D | null, options?: AvatarViewOptions): void;
|
|
994
994
|
/** Brings the body's hands to the tool in them, in both views; `view` keeps them in the first-person view (`RoomAvatar.reach`). */
|
|
995
995
|
reach(targets: HandTargets | null, view?: ReachView | null): void;
|
|
996
996
|
/** Plays a strike on the body (the only source of it, in both views) and answers the seconds to its impact (`RoomAvatar.strike`). */
|
|
@@ -1199,4 +1199,4 @@ type TwoBone = {
|
|
|
1199
1199
|
*/
|
|
1200
1200
|
declare const solveTwoBone: (root: THREE_NS.Vector3, target: THREE_NS.Vector3, upper: number, lower: number, pole: THREE_NS.Vector3, out: TwoBone) => TwoBone;
|
|
1201
1201
|
|
|
1202
|
-
export { ACCESSORY_BIT, type AccessoryAttach, ArmRig, AvatarItemUsePose, AvatarViewMode, BAKE_NEUTRAL_POSE, BODY_CHUNK, type BakeBuilders, type BakeSpec, type BakedBody, type BestBuilder, type BestBuilderOptions, type BestTypeCard, type BlobShadowBatch, type BlobShadowOptions, BloodLook, type BodyBatch, type BodyBatchMesh, type BodyBatchOptions, type BodyChunkOptions, type BodyInstance, type BodyJoints, type BodyMaterialParams, type BodyVariant, type BuildInstancedBodyParams, CHARACTER_SOUNDS, CHARACTER_SOUND_BANK, CLIPS_BIT, CLIP_BONES, CLIP_LIMIT, CLIP_RATE, CLIP_TEXELS, CharacterSound, type ClipLimp, EXTRAS, type EyeOptions, type Eyes, FACE_FEATURES, FIRST_PERSON_BOB, FIRST_PERSON_COLORS, FIRST_PERSON_RIG, FIRST_PERSON_STANCES, type FirstPersonArms, type FirstPersonArmsOptions, type FirstPersonArmsState, type FirstPersonBob, type FirstPersonColors, type FirstPersonEvent, type FirstPersonRig, FluidsBridge, type FlyingLimb, type FlyingLimbs, type FlyingLimbsOptions, type FlyingPiece, type FlyingPieces, type FlyingPiecesOptions, GAIT_STYLE, type GaitStyle, HAND_ITEMS, HATS, IMPOSTOR_ANGLES, IMPOSTOR_FRAMES, type IdentityLook, type ImpostorAtlas, type ImpostorAtlasOptions, type ImpostorBatch, type ImpostorBatchOptions, type ImpostorBody, type ImpostorBox, type ImpostorInstance, KIT_ACCESSORIES, type KitAccessory, LOD_BAKE, LOD_BATCH_CAPACITY, LOD_CASTS_SHADOW, LOD_DISTANCES, LOD_SEGMENTS, LegRig, type LimbEffects, type LimbLaunch, PENDULUM, type Pendulum, type PersonBuilder, type PersonBuilderOptions, PersonCharacter, PersonExtra, PersonGroupSpec, PersonSpec, PlayerAvatar, ReachView, type RestPose, RichRig, type RoomAvatarLike, SEGMENT_CLIPS, STAGGER_POSE, type SegmentClipSet, type SegmentClipSpec, type SegmentClipUniforms, type StanceDef, TROUSER_PALETTE, Three, type ToRoomAvatarOptions, type TwoBone, UNDEAD_VOICE_GROUP, type VariantBatchesOptions, type VariantType, type WoundBody, type WoundMaterials, type WoundNode, type Wounds, type WoundsOptions, accessoryPlacement, bakeBody, bakeImpostorAtlas, bakeSegmentClips, bakeVariants, blobGeometry, blobRadii, buildInstancedBody, buildKitAccessory, clipIndexOf, clipSpeedOf, createBestBuilder, createBlobShadowBatch, createBodyBatch, createBodyChunk, createBodyChunkExt, createBodyMaterial, createEye, createFirstPersonArms, createFlyingLimbs, createFlyingPieces, createGlowTexture, createImpostorBatch, createPendulum, createPersonBuilder, createSegmentClipUniforms, createVariantBatches, createWoundMaterials, createWounds, exitWound, explodeChunks, findEyes, gouge, jointsOf, lodAt, makeCut, makeStump, packIdentity, ringWound, solveTwoBone, starGeometry, stepPendulum, toRoomAvatar, unpackIdentity, walkPoseVertex, woundBodyOf, woundDecal };
|
|
1202
|
+
export { ACCESSORY_BIT, type AccessoryAttach, ArmRig, AvatarItemUsePose, AvatarViewMode, AvatarViewOptions, BAKE_NEUTRAL_POSE, BODY_CHUNK, type BakeBuilders, type BakeSpec, type BakedBody, type BestBuilder, type BestBuilderOptions, type BestTypeCard, type BlobShadowBatch, type BlobShadowOptions, BloodLook, type BodyBatch, type BodyBatchMesh, type BodyBatchOptions, type BodyChunkOptions, type BodyInstance, type BodyJoints, type BodyMaterialParams, type BodyVariant, type BuildInstancedBodyParams, CHARACTER_SOUNDS, CHARACTER_SOUND_BANK, CLIPS_BIT, CLIP_BONES, CLIP_LIMIT, CLIP_RATE, CLIP_TEXELS, CharacterSound, type ClipLimp, EXTRAS, type EyeOptions, type Eyes, FACE_FEATURES, FIRST_PERSON_BOB, FIRST_PERSON_COLORS, FIRST_PERSON_RIG, FIRST_PERSON_STANCES, type FirstPersonArms, type FirstPersonArmsOptions, type FirstPersonArmsState, type FirstPersonBob, type FirstPersonColors, type FirstPersonEvent, type FirstPersonRig, FluidsBridge, type FlyingLimb, type FlyingLimbs, type FlyingLimbsOptions, type FlyingPiece, type FlyingPieces, type FlyingPiecesOptions, GAIT_STYLE, type GaitStyle, HAND_ITEMS, HATS, IMPOSTOR_ANGLES, IMPOSTOR_FRAMES, type IdentityLook, type ImpostorAtlas, type ImpostorAtlasOptions, type ImpostorBatch, type ImpostorBatchOptions, type ImpostorBody, type ImpostorBox, type ImpostorInstance, KIT_ACCESSORIES, type KitAccessory, LOD_BAKE, LOD_BATCH_CAPACITY, LOD_CASTS_SHADOW, LOD_DISTANCES, LOD_SEGMENTS, LegRig, type LimbEffects, type LimbLaunch, PENDULUM, type Pendulum, type PersonBuilder, type PersonBuilderOptions, PersonCharacter, PersonExtra, PersonGroupSpec, PersonSpec, PlayerAvatar, ReachView, type RestPose, RichRig, type RoomAvatarLike, SEGMENT_CLIPS, STAGGER_POSE, type SegmentClipSet, type SegmentClipSpec, type SegmentClipUniforms, type StanceDef, TROUSER_PALETTE, Three, type ToRoomAvatarOptions, type TwoBone, UNDEAD_VOICE_GROUP, type VariantBatchesOptions, type VariantType, type WoundBody, type WoundMaterials, type WoundNode, type Wounds, type WoundsOptions, accessoryPlacement, bakeBody, bakeImpostorAtlas, bakeSegmentClips, bakeVariants, blobGeometry, blobRadii, buildInstancedBody, buildKitAccessory, clipIndexOf, clipSpeedOf, createBestBuilder, createBlobShadowBatch, createBodyBatch, createBodyChunk, createBodyChunkExt, createBodyMaterial, createEye, createFirstPersonArms, createFlyingLimbs, createFlyingPieces, createGlowTexture, createImpostorBatch, createPendulum, createPersonBuilder, createSegmentClipUniforms, createVariantBatches, createWoundMaterials, createWounds, exitWound, explodeChunks, findEyes, gouge, jointsOf, lodAt, makeCut, makeStump, packIdentity, ringWound, solveTwoBone, starGeometry, stepPendulum, toRoomAvatar, unpackIdentity, walkPoseVertex, woundBodyOf, woundDecal };
|
package/dist/index.global.js
CHANGED
|
@@ -11631,6 +11631,7 @@ ${accessoryHead}`).replace("{ vec3 _nn = objectNormal; bodyAnim(position, _nn);"
|
|
|
11631
11631
|
parent.add(mesh2);
|
|
11632
11632
|
return mesh2;
|
|
11633
11633
|
};
|
|
11634
|
+
const TRIGGER_CURL = 1.22;
|
|
11634
11635
|
const hands = [];
|
|
11635
11636
|
rig.arms.forEach((arm, index) => {
|
|
11636
11637
|
const el = arm.el;
|
|
@@ -11663,6 +11664,7 @@ ${accessoryHead}`).replace("{ vec3 _nn = objectNormal; bodyAnim(position, _nn);"
|
|
|
11663
11664
|
eyeSocket.position.set(BUILDER_EYE[0] + eyeOffset[0], BUILDER_EYE[1] + eyeOffset[1], BUILDER_EYE[2] + eyeOffset[2]);
|
|
11664
11665
|
rig.headG.children[0].add(eyeSocket);
|
|
11665
11666
|
const headHider = createHeadHider([rig.headG, ...rig.neck ? [rig.neck] : []]);
|
|
11667
|
+
const armsHider = createHeadHider(rig.arms.map((arm) => arm.g));
|
|
11666
11668
|
const eyeLocal = new THREE.Vector3();
|
|
11667
11669
|
let bob = 0;
|
|
11668
11670
|
let hipWithoutBob = null;
|
|
@@ -12010,7 +12012,10 @@ ${accessoryHead}`).replace("{ vec3 _nn = objectNormal; bodyAnim(position, _nn);"
|
|
|
12010
12012
|
root.updateWorldMatrix(true, false);
|
|
12011
12013
|
return root.localToWorld(out.copy(eyeLocal));
|
|
12012
12014
|
},
|
|
12013
|
-
setView: (mode, camera) =>
|
|
12015
|
+
setView: (mode, camera, viewOptions) => {
|
|
12016
|
+
headHider.setView(mode, camera);
|
|
12017
|
+
armsHider.setView(viewOptions?.arms ? mode : "third", camera);
|
|
12018
|
+
},
|
|
12014
12019
|
play(clip, playOptions = {}) {
|
|
12015
12020
|
const found = typeof clip === "string" ? clips.get(clip) : clip;
|
|
12016
12021
|
if (!found) throw new Error(`Unknown pose clip: ${String(clip)}`);
|
|
@@ -12027,6 +12032,13 @@ ${accessoryHead}`).replace("{ vec3 _nn = objectNormal; bodyAnim(position, _nn);"
|
|
|
12027
12032
|
if (run || fall > 0) return;
|
|
12028
12033
|
root.updateMatrixWorld(true);
|
|
12029
12034
|
armReach.apply(targets, view);
|
|
12035
|
+
for (const hand of hands) {
|
|
12036
|
+
const curl = hand.side < 0 ? targets?.fingers?.index : targets?.fingersL?.index;
|
|
12037
|
+
if (curl === void 0 || !hand.fingers[1]) continue;
|
|
12038
|
+
const k = TRIGGER_CURL * Math.min(1, Math.max(0, curl));
|
|
12039
|
+
hand.fingers[0].rotation.z = -hand.side * k * 0.9;
|
|
12040
|
+
hand.fingers[1].rotation.z = -hand.side * k * 1.1;
|
|
12041
|
+
}
|
|
12030
12042
|
},
|
|
12031
12043
|
on(_type, listener) {
|
|
12032
12044
|
listeners.add(listener);
|
|
@@ -12516,7 +12528,7 @@ ${accessoryHead}`).replace("{ vec3 _nn = objectNormal; bodyAnim(position, _nn);"
|
|
|
12516
12528
|
root: avatar.root,
|
|
12517
12529
|
avatar,
|
|
12518
12530
|
eye: (out) => avatar.eye(out),
|
|
12519
|
-
setView: (mode, camera) => avatar.setView(mode, camera),
|
|
12531
|
+
setView: (mode, camera, options2) => avatar.setView(mode, camera, options2),
|
|
12520
12532
|
update: (dt, state) => {
|
|
12521
12533
|
stepGuard(dt, state);
|
|
12522
12534
|
updateFeet(state);
|
|
@@ -12877,7 +12889,7 @@ ${accessoryHead}`).replace("{ vec3 _nn = objectNormal; bodyAnim(position, _nn);"
|
|
|
12877
12889
|
const channelPose = newPose(THREE);
|
|
12878
12890
|
const mixed = newPose(THREE);
|
|
12879
12891
|
const dropped = newPose(THREE);
|
|
12880
|
-
|
|
12892
|
+
const indexCurl = { R: void 0, L: void 0 };
|
|
12881
12893
|
const bone = createTwoBone(THREE);
|
|
12882
12894
|
const shoulder = new THREE.Vector3();
|
|
12883
12895
|
const wristAt = new THREE.Vector3();
|
|
@@ -12941,7 +12953,7 @@ ${accessoryHead}`).replace("{ vec3 _nn = objectNormal; bodyAnim(position, _nn);"
|
|
|
12941
12953
|
arm.anchor.quaternion.copy(pose.q);
|
|
12942
12954
|
arm.anchor.scale.setScalar(scale);
|
|
12943
12955
|
arm.hand.setGrip(pose.grip);
|
|
12944
|
-
arm.hand.setIndex(arm.side
|
|
12956
|
+
arm.hand.setIndex(indexCurl[arm.side]);
|
|
12945
12957
|
arm.joints.shoulder.copy(shoulder);
|
|
12946
12958
|
arm.joints.elbow.copy(bone.joint);
|
|
12947
12959
|
arm.joints.wrist.copy(bone.end);
|
|
@@ -13027,7 +13039,7 @@ ${accessoryHead}`).replace("{ vec3 _nn = objectNormal; bodyAnim(position, _nn);"
|
|
|
13027
13039
|
desired.p.add(bobOffset);
|
|
13028
13040
|
}
|
|
13029
13041
|
modeOf(mode, arm);
|
|
13030
|
-
|
|
13042
|
+
indexCurl[side] = mode === "target" ? side === "R" ? targets?.fingers?.index : targets?.fingersL?.index : void 0;
|
|
13031
13043
|
arm.blend = blendSeconds <= 0 ? 1 : Math.min(1, arm.blend + dt / blendSeconds);
|
|
13032
13044
|
if (arm.blend >= 1) copyPose(arm.shown, desired);
|
|
13033
13045
|
else mixPose(THREE, arm.shown, arm.from, desired, ease2(arm.blend));
|