@adatechnology/game-characters-three 0.6.0 → 0.7.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/README.md +1 -1
- package/dist/index.d.ts +164 -105
- package/dist/index.global.js +604 -331
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +522 -333
- package/dist/index.js.map +1 -1
- package/package.json +9 -9
package/README.md
CHANGED
|
@@ -48,7 +48,7 @@ down turns the body about the hip (`±1.5` rad, face up or down by the phase) wi
|
|
|
48
48
|
one button per registered clip (`Tocar: grabbed_bitten_human`, `grab_bite_zombie`, and with `clips: [...POSE_CLIPS, ...ATTACK_CLIPS]` the punch, shove, kick and the recoils; `clipLocales` gives the phase texts) and stop; metrics for the camera, the clip playing, the last clip event and the joints. Every action is a JSON line in the room log (`{"type":"avatar","action":"play_clip","clip":...}`), clip events included, and an `impact` event also gets its own `{"action":"impact","clip":...,"t":...}` line.
|
|
49
49
|
The module takes the body, the view (`camera: { mode, set }`) and the state (`state: { set }`) by option and imports only `@adatechnology/game-contracts`.
|
|
50
50
|
|
|
51
|
-
`toRoomAvatar` also gives the room
|
|
51
|
+
`toRoomAvatar` also gives the room `strike(clipId)`, which plays the attack clip on the body (the only source of a strike, first and third person) and answers the seconds to the impact read from that clip (the same in both views). `strike(clip, { leg: 'left' })` kicks with the left leg and `strike(clip, { hand: 'left' })` punches with the left hand: the mirror of the clip on the body (`mirrorPoseClip`, id `<clip>_left`). After a punch (an `impact` of kind `punch`) the body holds the guard (`guardClip`, default `'fight_guard'`, `false` for none) for
|
|
52
52
|
`guardHold` seconds (default 1.2) while it stands still, so a combo goes guard, punch, guard; the punch blends in over `punchBlend` (default 0.05 s). Walking, running, a weapon or a held item drop the guard.
|
|
53
53
|
|
|
54
54
|
**First-person arms.** `createFirstPersonArms(THREE, { colors?, rig?, stances?, clips?, blend?, bob? })` builds sleeves (upper arm, forearm, elbow, cuff) and hands of skin (palm, four fingers of three segments, a thumb that close on a grip) drawn in the camera's space, plus the right leg that only shows during a kick. `arms.update(dt, { camera, targets, stance, speed, running, crouch, contact? })`: the `relaxed` and `fists` stances are rest poses (`FIRST_PERSON_STANCES`, from `presets/first-person-arms.json`), `hold` follows the `HandTargets` of `game-contracts` (world space) with a two-bone IK from fixed shoulders, the elbow bending down and out; a target out of reach is clamped (the shoulder moves `reachShift` toward it first). `arms.play('punch_right' | 'shove_two_hands' | 'front_kick')` overlays a `FirstPersonClip` (`FIRST_PERSON_CLIPS` of `game-characters-people`, same durations and impact seconds as the attack clips); `arms.on('event', fn)` gives its `impact`; `arms.handPose(side)` reads where a hand is drawn. `contact(origin, direction, maxDistance)` (optional; distance to the first surface or null) makes the hands and the kick foot stop a few millimetres before a surface along the camera forward (the elbow bends); `arms.play('front_kick', { leg: 'left' })` kicks with the left leg and `arms.play('punch_right', { hand: 'left' })` punches with the left hand (the hands of the clip in a mirror). Hand frame: x wrist to knuckles, y back of the hand, z little-finger side; a left hand is the right one mirrored.
|
package/dist/index.d.ts
CHANGED
|
@@ -287,6 +287,8 @@ type RichRig = {
|
|
|
287
287
|
readonly fig: Node3;
|
|
288
288
|
readonly upper: Node3;
|
|
289
289
|
readonly headG: Node3;
|
|
290
|
+
/** The neck cylinder, taken by identity; absent when the head is cut off. */
|
|
291
|
+
readonly neck?: Node3;
|
|
290
292
|
readonly arms: RigArm[];
|
|
291
293
|
readonly legs: RigLeg[];
|
|
292
294
|
readonly dangles: {
|
|
@@ -1026,6 +1028,26 @@ declare const UNDEAD_VOICE_GROUP = "undead_voice";
|
|
|
1026
1028
|
declare const CHARACTER_SOUNDS: readonly SoundRecipe[];
|
|
1027
1029
|
declare const CHARACTER_SOUND_BANK: SoundBank;
|
|
1028
1030
|
|
|
1031
|
+
/**
|
|
1032
|
+
* The eye the hands are seen from, given per call to `apply` (null or none is the body seen from outside: nothing changes). `reachBend` keeps the elbow bent where a hand is out of reach, the hand stopping
|
|
1033
|
+
* short instead of the arm locking; `keepOutside` pulls a hand back so it stays in front of the surface `contact` finds along the camera's forward.
|
|
1034
|
+
*/
|
|
1035
|
+
type ReachView = {
|
|
1036
|
+
readonly camera: THREE_NS.Object3D;
|
|
1037
|
+
/** The least interior bend of the elbow, radians, right then left. Default `ARM_REACH.viewBend`. */
|
|
1038
|
+
readonly reachBend?: readonly [number, number];
|
|
1039
|
+
readonly keepOutside?: {
|
|
1040
|
+
/** The distance to the surface from `origin` along `direction` within `maxDistance`, or null. */
|
|
1041
|
+
contact(origin: [number, number, number], direction: [number, number, number], maxDistance: number): number | null;
|
|
1042
|
+
/** Default `ARM_REACH.contactMargin`. */
|
|
1043
|
+
readonly margin?: number;
|
|
1044
|
+
/** Default `ARM_REACH.contactNearest`. */
|
|
1045
|
+
readonly nearest?: number;
|
|
1046
|
+
};
|
|
1047
|
+
};
|
|
1048
|
+
|
|
1049
|
+
type AvatarViewMode = 'first' | 'third';
|
|
1050
|
+
|
|
1029
1051
|
type PlayerAvatarSpec = Record<string, unknown>;
|
|
1030
1052
|
type PlayerAvatarOptions = {
|
|
1031
1053
|
/** The body spec for the rich builder (`createBestBuilder.build`). Default: the team game's player (`player-avatar.json`). Merged over the default. */
|
|
@@ -1045,6 +1067,10 @@ type PlayerAvatarOptions = {
|
|
|
1045
1067
|
* still be on their way when it ends (a punch that never reaches the shoulder). 1 keeps the walk's pace. Default 5.
|
|
1046
1068
|
*/
|
|
1047
1069
|
readonly clipCascade?: number;
|
|
1070
|
+
/** Where the eye sits against the builder's eye point, in the head's frame (so it follows the head's scale and turn). Default [0, -0.068, 0]: about 1.70 m standing. */
|
|
1071
|
+
readonly eyeOffset?: readonly [number, number, number];
|
|
1072
|
+
/** How much of the walking and running bob of the body reaches the eye: 0 none, 1 all of it. Default 0.5. */
|
|
1073
|
+
readonly eyeBob?: number;
|
|
1048
1074
|
};
|
|
1049
1075
|
type AvatarEvent = PoseClipEvent & {
|
|
1050
1076
|
clip: string;
|
|
@@ -1053,6 +1079,8 @@ type AvatarItemUsePose = {
|
|
|
1053
1079
|
readonly id: string;
|
|
1054
1080
|
readonly position: readonly [number, number, number];
|
|
1055
1081
|
readonly rotation: readonly [number, number, number];
|
|
1082
|
+
/** How closed the other hand is (0 open to 1 closed) when it works on the item, as a hand turning a cap off opens between strokes; the room brings it there with `reach`. */
|
|
1083
|
+
readonly gripL?: number;
|
|
1056
1084
|
};
|
|
1057
1085
|
type AvatarUpdate = {
|
|
1058
1086
|
/** Ground speed, m/s. Ties cadence and swing to the ground (the game's `walkCad` and `walkGait`). */
|
|
@@ -1076,6 +1104,21 @@ type AvatarUpdate = {
|
|
|
1076
1104
|
readonly phase: 'grip' | 'push' | 'strain';
|
|
1077
1105
|
readonly progress: number;
|
|
1078
1106
|
} | null;
|
|
1107
|
+
/** On a seat: `sit` folds the legs under hips `hip` metres above the feet, `lie` lays the body face up with the pelvis there, the head behind the facing. */
|
|
1108
|
+
seat?: {
|
|
1109
|
+
readonly pose: 'sit' | 'lie';
|
|
1110
|
+
readonly hip: number;
|
|
1111
|
+
} | null;
|
|
1112
|
+
/**
|
|
1113
|
+
* A hand on a door, lid or drawer: `reach` to the handle, `swing` with it (`pull` toward the body or pushed away), `release` back, `rattle` on a locked one.
|
|
1114
|
+
* `height` is the hand over the feet, metres (a fridge handle, a car door, a low drawer).
|
|
1115
|
+
*/
|
|
1116
|
+
door?: {
|
|
1117
|
+
readonly phase: 'reach' | 'swing' | 'release' | 'rattle';
|
|
1118
|
+
readonly progress: number;
|
|
1119
|
+
readonly height: number;
|
|
1120
|
+
readonly pull: boolean;
|
|
1121
|
+
} | null;
|
|
1079
1122
|
};
|
|
1080
1123
|
type PlayPoseOptions = {
|
|
1081
1124
|
onEvent?: (event: AvatarEvent) => void;
|
|
@@ -1098,16 +1141,26 @@ type PlayerAvatar = {
|
|
|
1098
1141
|
/** The three.js namespace the body was made with, so what is made to fit it (the first-person arms) uses the same one. */
|
|
1099
1142
|
readonly three: Three;
|
|
1100
1143
|
update(dt: number, state?: AvatarUpdate): void;
|
|
1144
|
+
/**
|
|
1145
|
+
* The world position of the eyes, as `update` left them: sampled at its end, before any `reach()` (which turns the chest and would swing the head), and kept in the
|
|
1146
|
+
* body's own frame so it stays right when the host moves `root` afterwards. With `out` it fills that vector instead of making one.
|
|
1147
|
+
*/
|
|
1148
|
+
eye(out?: THREE_NS.Vector3): THREE_NS.Vector3;
|
|
1149
|
+
/** In 'first' with a camera, the head and neck are not drawn for that camera only (shadows, mirrors and every other camera still see them); 'third' draws them. */
|
|
1150
|
+
setView(mode: AvatarViewMode, camera: THREE_NS.Object3D | null): void;
|
|
1101
1151
|
play(clip: string | PoseClip, options?: PlayPoseOptions): void;
|
|
1102
1152
|
stop(): void;
|
|
1103
1153
|
readonly playing: string | null;
|
|
1104
1154
|
/** A socket at the hand: 'R' is the weapon hand (the puppet's right, at -x), 'L' the other one. */
|
|
1105
1155
|
hand(side: 'R' | 'L'): THREE_NS.Object3D;
|
|
1156
|
+
/** The joint of a shoulder ('R' the weapon side, at -x): where a long gun's stock rests, just inside it. */
|
|
1157
|
+
shoulder(side: 'R' | 'L'): THREE_NS.Object3D;
|
|
1106
1158
|
/**
|
|
1107
1159
|
* Brings the hands to where the tool in them asks (`HandTargets`, world space) after `update`: shoulder, elbow and wrist each bend inside the human range, the chest turns and the shoulder
|
|
1108
1160
|
* blade slides toward a hand out of reach. Null, a strike playing or the body going down leave the arms as `update` posed them. Call it after the tool is placed and the root moved.
|
|
1161
|
+
* `view` (given on each call, as the camera moves) is for the body seen from its own eyes: the elbows keep their bend and the hands stay out of walls; without it nothing changes.
|
|
1109
1162
|
*/
|
|
1110
|
-
reach(targets: HandTargets | null): void;
|
|
1163
|
+
reach(targets: HandTargets | null, view?: ReachView | null): void;
|
|
1111
1164
|
on(type: 'event', listener: (event: AvatarEvent) => void): () => void;
|
|
1112
1165
|
dispose(): void;
|
|
1113
1166
|
};
|
|
@@ -1117,6 +1170,104 @@ type PlayerAvatar = {
|
|
|
1117
1170
|
*/
|
|
1118
1171
|
declare const createPlayerAvatar: (THREE: Three, options?: PlayerAvatarOptions) => PlayerAvatar;
|
|
1119
1172
|
|
|
1173
|
+
/** What `@adatechnology/game-test-room` calls a `RoomAvatar`, restated here so this package does not depend on the room. */
|
|
1174
|
+
type RoomAvatarLike = {
|
|
1175
|
+
root: THREE_NS.Object3D;
|
|
1176
|
+
update(dt: number, state: {
|
|
1177
|
+
speed: number;
|
|
1178
|
+
running: boolean;
|
|
1179
|
+
crouch: boolean;
|
|
1180
|
+
down: boolean;
|
|
1181
|
+
armed: boolean;
|
|
1182
|
+
pitch: number;
|
|
1183
|
+
push?: {
|
|
1184
|
+
readonly phase: 'grip' | 'push' | 'strain';
|
|
1185
|
+
readonly progress: number;
|
|
1186
|
+
} | null;
|
|
1187
|
+
door?: {
|
|
1188
|
+
readonly phase: 'reach' | 'swing' | 'release' | 'rattle';
|
|
1189
|
+
readonly progress: number;
|
|
1190
|
+
readonly height: number;
|
|
1191
|
+
readonly pull: boolean;
|
|
1192
|
+
} | null;
|
|
1193
|
+
holding?: boolean;
|
|
1194
|
+
itemUse?: AvatarItemUsePose | null;
|
|
1195
|
+
seat?: {
|
|
1196
|
+
readonly pose: 'sit' | 'lie';
|
|
1197
|
+
readonly hip: number;
|
|
1198
|
+
} | null;
|
|
1199
|
+
}): void;
|
|
1200
|
+
hand(side: 'R' | 'L'): THREE_NS.Object3D;
|
|
1201
|
+
shoulder(side: 'R' | 'L'): THREE_NS.Object3D;
|
|
1202
|
+
/** 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. */
|
|
1203
|
+
eye(out?: THREE_NS.Vector3): THREE_NS.Vector3;
|
|
1204
|
+
/** Hides the head and neck from `camera` in first person (`RoomAvatar.setView`). */
|
|
1205
|
+
setView(mode: AvatarViewMode, camera: THREE_NS.Object3D | null): void;
|
|
1206
|
+
/** Brings the body's hands to the tool in them, in both views; `view` keeps them in the first-person view (`RoomAvatar.reach`). */
|
|
1207
|
+
reach(targets: HandTargets | null, view?: ReachView | null): void;
|
|
1208
|
+
/** Plays a strike on the body (the only source of it, in both views) and answers the seconds to its impact (`RoomAvatar.strike`). */
|
|
1209
|
+
strike(clipId: string, options?: {
|
|
1210
|
+
leg?: 'left' | 'right';
|
|
1211
|
+
hand?: 'left' | 'right';
|
|
1212
|
+
}): number | null;
|
|
1213
|
+
/** The avatar it wraps. */
|
|
1214
|
+
readonly avatar: PlayerAvatar;
|
|
1215
|
+
};
|
|
1216
|
+
type ToRoomAvatarOptions = {
|
|
1217
|
+
/** The third-person strike clips `strike` finds by id. Default `ATTACK_CLIPS` of game-characters-people. */
|
|
1218
|
+
strikeClips?: readonly PoseClip[];
|
|
1219
|
+
/** The looping clip the body holds between punches (a clip of `strikeClips`), so a combo goes guard, punch, guard instead of dropping the hands each time; `false` for none. Default `'fight_guard'`. */
|
|
1220
|
+
guardClip?: string | false;
|
|
1221
|
+
/** Seconds the guard stays up after a punch ends. Default 1.2. */
|
|
1222
|
+
guardHold?: number;
|
|
1223
|
+
/** Seconds a punch takes to blend in over the walk (or the guard it comes from). Default 0.05: the fist leaves at once. */
|
|
1224
|
+
punchBlend?: number;
|
|
1225
|
+
};
|
|
1226
|
+
/**
|
|
1227
|
+
* Fits the player's body to the test room's `RoomAvatar` (`room.setAvatar(toRoomAvatar(createPlayerAvatar(THREE)))`). It changes the sign of the pitch: the room
|
|
1228
|
+
* counts a look up as positive, the team game's `view.pitch` (what `AvatarUpdate.pitch` reads) counts a look down as positive. The same body is the first-person view (`eye`, `setView`), and `strike(clipId)` plays the strike on the body (the attack clips) and answers the seconds to its
|
|
1229
|
+
* impact, which are the same in both views. A kick with the left leg (`leg: 'left'`) or a punch with the left hand (`hand: 'left'`) plays the mirror of the clip written for the right.
|
|
1230
|
+
* After a punch the body holds the guard (`guardClip`) for `guardHold` seconds while it stands, so the next punch leaves from the guard.
|
|
1231
|
+
*/
|
|
1232
|
+
declare const toRoomAvatar: (avatar: PlayerAvatar, options?: ToRoomAvatarOptions) => RoomAvatarLike;
|
|
1233
|
+
|
|
1234
|
+
declare const AVATAR_AREA_ID = "avatar_area";
|
|
1235
|
+
type AvatarTestOptions = {
|
|
1236
|
+
/** The body under test (the example makes it with `createPlayerAvatar(THREE)` and gives the same one to the room). */
|
|
1237
|
+
avatar: PlayerAvatar;
|
|
1238
|
+
/** The text language when the host does not ask for one. Default `pt-BR`. */
|
|
1239
|
+
locale?: string;
|
|
1240
|
+
/** The clips offered as buttons. Default `POSE_CLIPS` (the two of the Bestiário); a game adds its strikes, such as `ATTACK_CLIPS` of game-characters-people. */
|
|
1241
|
+
clips?: readonly PoseClip[];
|
|
1242
|
+
/** Texts of the `phase` labels of `clips` by locale, merged over `POSE_CLIP_LOCALES` (for example `ATTACK_CLIP_LOCALES`). */
|
|
1243
|
+
clipLocales?: Readonly<Record<string, Readonly<Record<string, string>>>>;
|
|
1244
|
+
/** The room's view: `mode()` reads it, `set` changes it (`room.cameraMode` and `room.setCameraMode`). Without it the camera buttons only log. */
|
|
1245
|
+
camera?: {
|
|
1246
|
+
mode(): 'first' | 'third';
|
|
1247
|
+
set(mode: 'first' | 'third'): void;
|
|
1248
|
+
};
|
|
1249
|
+
/** The room's avatar state (`room.setAvatarState`): the module drives crouch, down and the armed arms through it. */
|
|
1250
|
+
state?: {
|
|
1251
|
+
set(state: {
|
|
1252
|
+
crouch?: boolean;
|
|
1253
|
+
down?: boolean;
|
|
1254
|
+
armed?: boolean | null;
|
|
1255
|
+
}): void;
|
|
1256
|
+
};
|
|
1257
|
+
};
|
|
1258
|
+
/**
|
|
1259
|
+
* The player's body as a `TestableModule` for the area `avatar_area`: bench buttons for the view (1st and 3rd person), crouch, fall and get up, the armed arms and every registered
|
|
1260
|
+
* pose clip (grab, bite), and metrics for the camera, the clip, its last event and the joints. Every action goes to the room's
|
|
1261
|
+
* log as JSON. It uses only the contracts: the body, the camera and the state come in by option, so the module knows no room.
|
|
1262
|
+
*/
|
|
1263
|
+
declare function createAvatarTestModule(options: AvatarTestOptions): TestableModule & {
|
|
1264
|
+
readonly state: {
|
|
1265
|
+
crouch: boolean;
|
|
1266
|
+
down: boolean;
|
|
1267
|
+
armed: boolean | null;
|
|
1268
|
+
};
|
|
1269
|
+
};
|
|
1270
|
+
|
|
1120
1271
|
type Triple = [number, number, number];
|
|
1121
1272
|
/**
|
|
1122
1273
|
* A hand (or the foot) at rest, in the camera's space: x to the right, y up, the view looks down -z. `p` is the middle of the palm, `r` the Euler angles `[roll, yaw, pitch]` in the order YZX:
|
|
@@ -1143,6 +1294,17 @@ type FirstPersonRig = {
|
|
|
1143
1294
|
fore: number;
|
|
1144
1295
|
/** How far (m) a shoulder may move toward a hand it cannot reach, so long tools stay in the hands. 0 keeps the shoulders where they are. */
|
|
1145
1296
|
reachShift: number;
|
|
1297
|
+
/**
|
|
1298
|
+
* The elbow bend (radians, 0 straight) an arm keeps when its shoulder comes forward to a far hand, right then left: the shoulder stops short of a straight arm, so the
|
|
1299
|
+
* elbow and the wrist read on screen. Leave it out to stretch the arm to its full length first.
|
|
1300
|
+
*/
|
|
1301
|
+
reachBend?: readonly [number, number];
|
|
1302
|
+
/**
|
|
1303
|
+
* Holding a tool, the way from the wrist to the elbow (camera space, right arm then left; x right, y up, -z ahead): the elbow is put there, kept inside the view, and the shoulder
|
|
1304
|
+
* behind it out of the view, so the bend of the arm shows on screen (a trigger elbow out to the side, a support elbow out under the forend). Leave it out to keep the
|
|
1305
|
+
* shoulders fixed and bend the elbows toward `elbowPole`; null for one arm keeps that arm so (a support hand cups a handguard from below, its elbow under the view).
|
|
1306
|
+
*/
|
|
1307
|
+
elbowView?: readonly [Triple | null, Triple | null];
|
|
1146
1308
|
/** From the wrist (where the sleeve ends) to the middle of the palm. */
|
|
1147
1309
|
wrist: number;
|
|
1148
1310
|
/** The way the elbow bends, for the right arm; mirrored for the left. */
|
|
@@ -1249,109 +1411,6 @@ type FirstPersonArms = {
|
|
|
1249
1411
|
dispose(): void;
|
|
1250
1412
|
};
|
|
1251
1413
|
|
|
1252
|
-
/** What `@adatechnology/game-test-room` calls a `RoomAvatar`, restated here so this package does not depend on the room. */
|
|
1253
|
-
type RoomAvatarLike = {
|
|
1254
|
-
root: THREE_NS.Object3D;
|
|
1255
|
-
update(dt: number, state: {
|
|
1256
|
-
speed: number;
|
|
1257
|
-
running: boolean;
|
|
1258
|
-
crouch: boolean;
|
|
1259
|
-
down: boolean;
|
|
1260
|
-
armed: boolean;
|
|
1261
|
-
pitch: number;
|
|
1262
|
-
push?: {
|
|
1263
|
-
readonly phase: 'grip' | 'push' | 'strain';
|
|
1264
|
-
readonly progress: number;
|
|
1265
|
-
} | null;
|
|
1266
|
-
holding?: boolean;
|
|
1267
|
-
itemUse?: AvatarItemUsePose | null;
|
|
1268
|
-
}): void;
|
|
1269
|
-
hand(side: 'R' | 'L'): THREE_NS.Object3D;
|
|
1270
|
-
/** The arms of the first-person view (`RoomAvatar.firstPerson`); absent when `toRoomAvatar` was told to make none. */
|
|
1271
|
-
firstPerson?: {
|
|
1272
|
-
root: THREE_NS.Object3D;
|
|
1273
|
-
update(dt: number, state: {
|
|
1274
|
-
camera: THREE_NS.Object3D;
|
|
1275
|
-
targets: HandTargets | null;
|
|
1276
|
-
stance: string;
|
|
1277
|
-
speed: number;
|
|
1278
|
-
running: boolean;
|
|
1279
|
-
crouch: boolean;
|
|
1280
|
-
contact?(origin: [number, number, number], direction: [number, number, number], maxDistance: number): number | null;
|
|
1281
|
-
}): void;
|
|
1282
|
-
};
|
|
1283
|
-
/** Brings the body's hands to the tool in them, in third person (`RoomAvatar.reach`). */
|
|
1284
|
-
reach(targets: HandTargets | null): void;
|
|
1285
|
-
/** Plays a strike on the body and the arms and answers the seconds to its impact (`RoomAvatar.strike`). */
|
|
1286
|
-
strike(clipId: string, options?: {
|
|
1287
|
-
leg?: 'left' | 'right';
|
|
1288
|
-
hand?: 'left' | 'right';
|
|
1289
|
-
}): number | null;
|
|
1290
|
-
/** The avatar it wraps. */
|
|
1291
|
-
readonly avatar: PlayerAvatar;
|
|
1292
|
-
/** The first-person arms, for whoever wants more of them than the room asks (`play`, `on('event')`). */
|
|
1293
|
-
readonly arms: FirstPersonArms | null;
|
|
1294
|
-
};
|
|
1295
|
-
type ToRoomAvatarOptions = {
|
|
1296
|
-
/** The first-person arms: `false` for none, else the options of `createFirstPersonArms` (merged over the colours of the body and `firstPersonClips`). */
|
|
1297
|
-
firstPerson?: false | FirstPersonArmsOptions;
|
|
1298
|
-
/** The third-person strike clips `strike` finds by id. Default `ATTACK_CLIPS` of game-characters-people. */
|
|
1299
|
-
strikeClips?: readonly PoseClip[];
|
|
1300
|
-
/** The first-person clips the arms play. Default `FIRST_PERSON_CLIPS` of game-characters-people. */
|
|
1301
|
-
firstPersonClips?: readonly FirstPersonClip[];
|
|
1302
|
-
/** The looping clip the body holds between punches (a clip of `strikeClips`), so a combo goes guard, punch, guard instead of dropping the hands each time; `false` for none. Default `'fight_guard'`. */
|
|
1303
|
-
guardClip?: string | false;
|
|
1304
|
-
/** Seconds the guard stays up after a punch ends. Default 1.2. */
|
|
1305
|
-
guardHold?: number;
|
|
1306
|
-
/** Seconds a punch takes to blend in over the walk (or the guard it comes from). Default 0.05: the fist leaves at once. */
|
|
1307
|
-
punchBlend?: number;
|
|
1308
|
-
};
|
|
1309
|
-
/**
|
|
1310
|
-
* Fits the player's body to the test room's `RoomAvatar` (`room.setAvatar(toRoomAvatar(createPlayerAvatar(THREE)))`). It changes the sign of the pitch: the room
|
|
1311
|
-
* counts a look up as positive, the team game's `view.pitch` (what `AvatarUpdate.pitch` reads) counts a look down as positive. It also gives the room the first-person arms, dressed in the
|
|
1312
|
-
* colours of the body (`firstPerson: false` for none), and `strike(clipId)`: the strike plays on the body (the attack clips) and on the arms (the first-person clips), and answers the seconds to its
|
|
1313
|
-
* impact, which are the same in both views. A kick with the left leg (`leg: 'left'`) or a punch with the left hand (`hand: 'left'`) plays the mirror of the clip written for the right.
|
|
1314
|
-
* After a punch the body holds the guard (`guardClip`) for `guardHold` seconds while it stands, so the next punch leaves from the guard.
|
|
1315
|
-
*/
|
|
1316
|
-
declare const toRoomAvatar: (avatar: PlayerAvatar, options?: ToRoomAvatarOptions) => RoomAvatarLike;
|
|
1317
|
-
|
|
1318
|
-
declare const AVATAR_AREA_ID = "avatar_area";
|
|
1319
|
-
type AvatarTestOptions = {
|
|
1320
|
-
/** The body under test (the example makes it with `createPlayerAvatar(THREE)` and gives the same one to the room). */
|
|
1321
|
-
avatar: PlayerAvatar;
|
|
1322
|
-
/** The text language when the host does not ask for one. Default `pt-BR`. */
|
|
1323
|
-
locale?: string;
|
|
1324
|
-
/** The clips offered as buttons. Default `POSE_CLIPS` (the two of the Bestiário); a game adds its strikes, such as `ATTACK_CLIPS` of game-characters-people. */
|
|
1325
|
-
clips?: readonly PoseClip[];
|
|
1326
|
-
/** Texts of the `phase` labels of `clips` by locale, merged over `POSE_CLIP_LOCALES` (for example `ATTACK_CLIP_LOCALES`). */
|
|
1327
|
-
clipLocales?: Readonly<Record<string, Readonly<Record<string, string>>>>;
|
|
1328
|
-
/** The room's view: `mode()` reads it, `set` changes it (`room.cameraMode` and `room.setCameraMode`). Without it the camera buttons only log. */
|
|
1329
|
-
camera?: {
|
|
1330
|
-
mode(): 'first' | 'third';
|
|
1331
|
-
set(mode: 'first' | 'third'): void;
|
|
1332
|
-
};
|
|
1333
|
-
/** The room's avatar state (`room.setAvatarState`): the module drives crouch, down and the armed arms through it. */
|
|
1334
|
-
state?: {
|
|
1335
|
-
set(state: {
|
|
1336
|
-
crouch?: boolean;
|
|
1337
|
-
down?: boolean;
|
|
1338
|
-
armed?: boolean | null;
|
|
1339
|
-
}): void;
|
|
1340
|
-
};
|
|
1341
|
-
};
|
|
1342
|
-
/**
|
|
1343
|
-
* The player's body as a `TestableModule` for the area `avatar_area`: bench buttons for the view (1st and 3rd person), crouch, fall and get up, the armed arms and every registered
|
|
1344
|
-
* pose clip (grab, bite), and metrics for the camera, the clip, its last event and the joints. Every action goes to the room's
|
|
1345
|
-
* log as JSON. It uses only the contracts: the body, the camera and the state come in by option, so the module knows no room.
|
|
1346
|
-
*/
|
|
1347
|
-
declare function createAvatarTestModule(options: AvatarTestOptions): TestableModule & {
|
|
1348
|
-
readonly state: {
|
|
1349
|
-
crouch: boolean;
|
|
1350
|
-
down: boolean;
|
|
1351
|
-
armed: boolean | null;
|
|
1352
|
-
};
|
|
1353
|
-
};
|
|
1354
|
-
|
|
1355
1414
|
/** The stances of the preset: `relaxed` and `fists` are rest poses, `hold` follows the targets of the tool in the hands. */
|
|
1356
1415
|
declare const FIRST_PERSON_STANCES: Readonly<Record<string, StanceDef>>;
|
|
1357
1416
|
/** The rig of the preset: shoulders, bones, elbow pole, hips and the leg of the kick. */
|
|
@@ -1387,4 +1446,4 @@ type TwoBone = {
|
|
|
1387
1446
|
*/
|
|
1388
1447
|
declare const solveTwoBone: (root: THREE_NS.Vector3, target: THREE_NS.Vector3, upper: number, lower: number, pole: THREE_NS.Vector3, out: TwoBone) => TwoBone;
|
|
1389
1448
|
|
|
1390
|
-
export { AVATAR_AREA_ID, type AreaContext, type AvatarEvent, type AvatarItemUsePose, type AvatarTestOptions, type AvatarUpdate, BAKE_NEUTRAL_POSE, BODY_CHUNK, BODY_MATERIAL_DEF, BODY_SOUNDS, type BakeBuilders, type BakeSpec, type BakedBody, type BestBuilder, type BestBuilderOptions, type BestTypeCard, type BloodAge, type BloodLook, type BloodLookOptions, type BloodSink, type BodyBatch, type BodyBatchOptions, type BodyChunkOptions, type BodyInstance, type BodyJoints, type BodyMaterialParams, type BodySoundRule, type BodyVariant, type BuildInstancedBodyParams, CHARACTERS_AREA_ID, CHARACTER_SOUNDS, CHARACTER_SOUND_BANK, type CharacterSound, type CharacterSoundOptions, type CharacterSoundSink, type CharacterSoundStyle, type CharactersTestOptions, EXTRAS, type EyeOptions, type Eyes, FACE_FEATURES, FIRST_PERSON_BOB, FIRST_PERSON_COLORS, FIRST_PERSON_RIG, FIRST_PERSON_STANCES, type FilmSink, type FirstPersonArms, type FirstPersonArmsOptions, type FirstPersonArmsState, type FirstPersonBob, type FirstPersonColors, type FirstPersonEvent, type FirstPersonRig, type FluidsBridge, type FluidsBridgeOptions, type FlyingLimb, type FlyingLimbs, type FlyingLimbsOptions, type FlyingPiece, type FlyingPieces, type FlyingPiecesOptions, HAND_ITEMS, HATS, HIT_PRESETS, type HitPreset, LOD_BAKE, LOD_BATCH_CAPACITY, LOD_CASTS_SHADOW, LOD_DISTANCES, LOD_SEGMENTS, type LimbEffects, type LimbLaunch, PENDULUM, PERSON_ITEM_PREFIX, PLAYER_SOUNDS, type Pendulum, type PersonBuilder, type PersonBuilderOptions, type PlayPoseOptions, type PlayerAvatar, type PlayerAvatarColors, type PlayerAvatarOptions, type PlayerAvatarSpec, type PoseTargets, type ProfessionCard, type RestPose, type RichRig, type RigAnimator, type RigAnimatorOptions, type RoomAvatarLike, type StanceDef, type Three, type ToRoomAvatarOptions, type TwoBone, UNDEAD_VOICES, UNDEAD_VOICE_GROUP, UNDEAD_VOICE_SOURCES, type UndeadCard, type UndeadLike, type UndeadVoice, type VariantType, type VoiceMoment, type VoiceStep, type WoundBody, type WoundMaterials, type WoundNode, type WoundSpray, type Wounds, type WoundsOptions, ZOMBIE_ITEM_PREFIX, bakeBody, bakeVariants, blobGeometry, blobRadii, bloodLookOfAge, buildInstancedBody, createAvatarTestModule, createBestBuilder, createBodyBatch, createBodyChunk, createBodyMaterial, createCharacterSound, createCharactersTestModule, createEye, createFirstPersonArms, createFluidsBridge, createFlyingLimbs, createFlyingPieces, createGlowTexture, createPendulum, createPersonBuilder, createPlayerAvatar, createRigAnimator, createVariantBatches, createWoundMaterials, createWounds, exitWound, explodeChunks, findEyes, gouge, jointsOf, lodAt, makeCut, makeStump, personSpecOf, registerBodyMaterial, ringWound, solveTwoBone, starGeometry, stepPendulum, toRoomAvatar, woundBodyOf, woundDecal };
|
|
1449
|
+
export { AVATAR_AREA_ID, type AreaContext, type AvatarEvent, type AvatarItemUsePose, type AvatarTestOptions, type AvatarUpdate, type AvatarViewMode, BAKE_NEUTRAL_POSE, BODY_CHUNK, BODY_MATERIAL_DEF, BODY_SOUNDS, type BakeBuilders, type BakeSpec, type BakedBody, type BestBuilder, type BestBuilderOptions, type BestTypeCard, type BloodAge, type BloodLook, type BloodLookOptions, type BloodSink, type BodyBatch, type BodyBatchOptions, type BodyChunkOptions, type BodyInstance, type BodyJoints, type BodyMaterialParams, type BodySoundRule, type BodyVariant, type BuildInstancedBodyParams, CHARACTERS_AREA_ID, CHARACTER_SOUNDS, CHARACTER_SOUND_BANK, type CharacterSound, type CharacterSoundOptions, type CharacterSoundSink, type CharacterSoundStyle, type CharactersTestOptions, EXTRAS, type EyeOptions, type Eyes, FACE_FEATURES, FIRST_PERSON_BOB, FIRST_PERSON_COLORS, FIRST_PERSON_RIG, FIRST_PERSON_STANCES, type FilmSink, type FirstPersonArms, type FirstPersonArmsOptions, type FirstPersonArmsState, type FirstPersonBob, type FirstPersonColors, type FirstPersonEvent, type FirstPersonRig, type FluidsBridge, type FluidsBridgeOptions, type FlyingLimb, type FlyingLimbs, type FlyingLimbsOptions, type FlyingPiece, type FlyingPieces, type FlyingPiecesOptions, HAND_ITEMS, HATS, HIT_PRESETS, type HitPreset, LOD_BAKE, LOD_BATCH_CAPACITY, LOD_CASTS_SHADOW, LOD_DISTANCES, LOD_SEGMENTS, type LimbEffects, type LimbLaunch, PENDULUM, PERSON_ITEM_PREFIX, PLAYER_SOUNDS, type Pendulum, type PersonBuilder, type PersonBuilderOptions, type PlayPoseOptions, type PlayerAvatar, type PlayerAvatarColors, type PlayerAvatarOptions, type PlayerAvatarSpec, type PoseTargets, type ProfessionCard, type ReachView, type RestPose, type RichRig, type RigAnimator, type RigAnimatorOptions, type RoomAvatarLike, type StanceDef, type Three, type ToRoomAvatarOptions, type TwoBone, UNDEAD_VOICES, UNDEAD_VOICE_GROUP, UNDEAD_VOICE_SOURCES, type UndeadCard, type UndeadLike, type UndeadVoice, type VariantType, type VoiceMoment, type VoiceStep, type WoundBody, type WoundMaterials, type WoundNode, type WoundSpray, type Wounds, type WoundsOptions, ZOMBIE_ITEM_PREFIX, bakeBody, bakeVariants, blobGeometry, blobRadii, bloodLookOfAge, buildInstancedBody, createAvatarTestModule, createBestBuilder, createBodyBatch, createBodyChunk, createBodyMaterial, createCharacterSound, createCharactersTestModule, createEye, createFirstPersonArms, createFluidsBridge, createFlyingLimbs, createFlyingPieces, createGlowTexture, createPendulum, createPersonBuilder, createPlayerAvatar, createRigAnimator, createVariantBatches, createWoundMaterials, createWounds, exitWound, explodeChunks, findEyes, gouge, jointsOf, lodAt, makeCut, makeStump, personSpecOf, registerBodyMaterial, ringWound, solveTwoBone, starGeometry, stepPendulum, toRoomAvatar, woundBodyOf, woundDecal };
|