@adatechnology/game-player 0.12.1 → 0.12.3
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 +9 -1
- package/dist/index.global.js +19 -0
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +19 -0
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
package/dist/index.d.ts
CHANGED
|
@@ -25,12 +25,20 @@ type PhysicsPlayerController = PlayerController & {
|
|
|
25
25
|
};
|
|
26
26
|
declare const PLAYER_MASS_KG = 75;
|
|
27
27
|
declare const PLAYER_PUSH_STRENGTH_NEWTONS = 400;
|
|
28
|
+
/** The most a person puts into what is in the way just by walking into it, without leaning on it on purpose: about the sustained push force of ISO 11228-2 for a man (100 N), the order of what a walk can keep up. A thing whose floor grip is above it (a 28 kg sofa on wood: 115 N) stops the walk; a lighter one is shoved along. */
|
|
29
|
+
declare const PLAYER_WALK_PUSH_NEWTONS = 100;
|
|
28
30
|
/**
|
|
29
31
|
* The player's controller in a physics world: a capsule as tall as the standing body (a crouch does not shrink it) that steps up, climbs, pushes props and is
|
|
30
32
|
* pushed. Put it in `PlayerWorld.controller` and call `player.update(h, input)` from a `beforeStep(h)` of the loop's `actors` phase, never with the frame's `dt`.
|
|
31
33
|
*/
|
|
32
34
|
declare const createPhysicsController: (world: PlayerPhysicsWorld, options: PhysicsControllerOptions) => PhysicsPlayerController;
|
|
33
35
|
|
|
36
|
+
/**
|
|
37
|
+
* The height a round foot of `radius` comes to rest at over ground `heightAt` (the lower sphere of the capsule): the highest, over the points of the disc under it, of
|
|
38
|
+
* the ground there less how far the sphere's underside rises above its lowest point at that distance. Flat ground gives its own height; a bowl holds the foot above its middle.
|
|
39
|
+
*/
|
|
40
|
+
declare const footRestHeight: (heightAt: (x: number, z: number) => number, x: number, z: number, radius: number) => number;
|
|
41
|
+
|
|
34
42
|
/** The vertical speed (m/s) of a jump under the world's 9.81: it rises 0.81 m, as high as the walker's own jump always did. */
|
|
35
43
|
declare const WALKER_JUMP_SPEED = 3.99;
|
|
36
44
|
type WalkerStance = 'standing' | 'crouched' | 'prone';
|
|
@@ -497,4 +505,4 @@ declare const STEP_POSE_DEFAULTS: {
|
|
|
497
505
|
};
|
|
498
506
|
declare function createStepPose(start: StepPosition, options?: StepPoseOptions): StepPose;
|
|
499
507
|
|
|
500
|
-
export { type BodyHand, DOOR_ARM_REACH, DOOR_SHOULDER_HEIGHT, DOOR_USE_DEFAULTS, type DoorUse, type DoorUseBlock, type DoorUseHand, type DoorUsePhase, type DoorUseRules, type DoorUseStep, type DoorUseTarget, type DragMark, FURNITURE_PUSH_DEFAULTS, type FurniturePush, type FurniturePushBlock, type FurniturePushInput, type FurniturePushLoad, type FurniturePushPhase, type FurniturePushRules, type FurniturePushStep, type FurniturePushTarget, HANDS_DEFAULTS, HANDS_TIMING, type HandWeapon, type HandsMove, type HandsMoveKind, type HandsPlan, type HandsRules, type HandsTiming, ITEM_GRIP, type ItemGrip, KnownDeathCause, PLAYER_MASS_KG, PLAYER_PUSH_STRENGTH_NEWTONS, PLAYER_TEXT, type PhysicsControllerOptions, type PhysicsPlayerController, type PlanHandsParams, PlayerCollider, PlayerController, PlayerMessageId, type PlayerPhysicsWorld, type PlayerText, type Pose, type QuatTuple, SLING_SLOT, SLOT_FALLBACKS, STEP_POSE_DEFAULTS, type StepPose, type StepPoseOptions, type StepPosition, type TakeProgress, type TakeSequence, type TakeStep, type TakeStepKind, type TakeTimeline, type Vec3Tuple, WALKER_JUMP_SPEED, type Walker, type WalkerOptions, type WalkerServices, type WalkerStance, blendPoses, canPush, composePose, conjugateQuaternion, createDoorUse, createFurniturePush, createPhysicsController, createRng, createStepPose, createTakeTimeline, createWalker, dragMarkFor, drawBackOf, easeInOut, frictionFor, gripOfItem, gripSecondsFor, handPoseOnItem, interactionHandsFor, itemPoseInHand, multiplyQuaternions, planDrawSequence, planHands, planTakeSequence, playerTextOf, poseHolding, pushAccelerationFor, pushSpeedFor, quaternionOfBasis, rotateVector, slipsOnTop, swingSecondsFor };
|
|
508
|
+
export { type BodyHand, DOOR_ARM_REACH, DOOR_SHOULDER_HEIGHT, DOOR_USE_DEFAULTS, type DoorUse, type DoorUseBlock, type DoorUseHand, type DoorUsePhase, type DoorUseRules, type DoorUseStep, type DoorUseTarget, type DragMark, FURNITURE_PUSH_DEFAULTS, type FurniturePush, type FurniturePushBlock, type FurniturePushInput, type FurniturePushLoad, type FurniturePushPhase, type FurniturePushRules, type FurniturePushStep, type FurniturePushTarget, HANDS_DEFAULTS, HANDS_TIMING, type HandWeapon, type HandsMove, type HandsMoveKind, type HandsPlan, type HandsRules, type HandsTiming, ITEM_GRIP, type ItemGrip, KnownDeathCause, PLAYER_MASS_KG, PLAYER_PUSH_STRENGTH_NEWTONS, PLAYER_TEXT, PLAYER_WALK_PUSH_NEWTONS, type PhysicsControllerOptions, type PhysicsPlayerController, type PlanHandsParams, PlayerCollider, PlayerController, PlayerMessageId, type PlayerPhysicsWorld, type PlayerText, type Pose, type QuatTuple, SLING_SLOT, SLOT_FALLBACKS, STEP_POSE_DEFAULTS, type StepPose, type StepPoseOptions, type StepPosition, type TakeProgress, type TakeSequence, type TakeStep, type TakeStepKind, type TakeTimeline, type Vec3Tuple, WALKER_JUMP_SPEED, type Walker, type WalkerOptions, type WalkerServices, type WalkerStance, blendPoses, canPush, composePose, conjugateQuaternion, createDoorUse, createFurniturePush, createPhysicsController, createRng, createStepPose, createTakeTimeline, createWalker, dragMarkFor, drawBackOf, easeInOut, footRestHeight, frictionFor, gripOfItem, gripSecondsFor, handPoseOnItem, interactionHandsFor, itemPoseInHand, multiplyQuaternions, planDrawSequence, planHands, planTakeSequence, playerTextOf, poseHolding, pushAccelerationFor, pushSpeedFor, quaternionOfBasis, rotateVector, slipsOnTop, swingSecondsFor };
|
package/dist/index.global.js
CHANGED
|
@@ -32,6 +32,7 @@ var GamePlayer = (() => {
|
|
|
32
32
|
PLAYER_MASS_KG: () => PLAYER_MASS_KG,
|
|
33
33
|
PLAYER_PUSH_STRENGTH_NEWTONS: () => PLAYER_PUSH_STRENGTH_NEWTONS,
|
|
34
34
|
PLAYER_TEXT: () => PLAYER_TEXT,
|
|
35
|
+
PLAYER_WALK_PUSH_NEWTONS: () => PLAYER_WALK_PUSH_NEWTONS,
|
|
35
36
|
SLING_SLOT: () => SLING_SLOT,
|
|
36
37
|
SLOT_FALLBACKS: () => SLOT_FALLBACKS,
|
|
37
38
|
STEP_POSE_DEFAULTS: () => STEP_POSE_DEFAULTS,
|
|
@@ -54,6 +55,7 @@ var GamePlayer = (() => {
|
|
|
54
55
|
drawBackOf: () => drawBackOf,
|
|
55
56
|
drawWound: () => drawWound,
|
|
56
57
|
easeInOut: () => easeInOut,
|
|
58
|
+
footRestHeight: () => footRestHeight,
|
|
57
59
|
frictionFor: () => frictionFor,
|
|
58
60
|
gripOfItem: () => gripOfItem,
|
|
59
61
|
gripSecondsFor: () => gripSecondsFor,
|
|
@@ -885,6 +887,7 @@ var GamePlayer = (() => {
|
|
|
885
887
|
// src/physics-controller.ts
|
|
886
888
|
var PLAYER_MASS_KG = 75;
|
|
887
889
|
var PLAYER_PUSH_STRENGTH_NEWTONS = 400;
|
|
890
|
+
var PLAYER_WALK_PUSH_NEWTONS = 100;
|
|
888
891
|
var createPhysicsController = (world, options) => {
|
|
889
892
|
const { radiusMetres, heightMetres } = options.collider;
|
|
890
893
|
const id = world.createCharacter({
|
|
@@ -905,6 +908,22 @@ var GamePlayer = (() => {
|
|
|
905
908
|
};
|
|
906
909
|
};
|
|
907
910
|
|
|
911
|
+
// src/foot-rest.ts
|
|
912
|
+
var RINGS = 32;
|
|
913
|
+
var SAMPLES_PER_RING = 48;
|
|
914
|
+
var footRestHeight = (heightAt, x, z, radius) => {
|
|
915
|
+
let rest = heightAt(x, z);
|
|
916
|
+
for (let ring = 1; ring <= RINGS; ring++) {
|
|
917
|
+
const distance = radius * ring / RINGS;
|
|
918
|
+
const lift = radius - Math.sqrt(radius * radius - distance * distance);
|
|
919
|
+
for (let sample = 0; sample < SAMPLES_PER_RING; sample++) {
|
|
920
|
+
const angle = 2 * Math.PI * sample / SAMPLES_PER_RING;
|
|
921
|
+
rest = Math.max(rest, heightAt(x + distance * Math.cos(angle), z + distance * Math.sin(angle)) - lift);
|
|
922
|
+
}
|
|
923
|
+
}
|
|
924
|
+
return rest;
|
|
925
|
+
};
|
|
926
|
+
|
|
908
927
|
// src/walker.ts
|
|
909
928
|
var WALKER_JUMP_SPEED = 3.99;
|
|
910
929
|
var STANCE_HEIGHT_RATIO = { standing: 1, crouched: 2 / 3, prone: 1 / 3 };
|