@mml-io/3d-web-client-core 0.1.0 → 0.2.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.
@@ -1,15 +1,25 @@
1
1
  import { PerspectiveCamera } from "three";
2
2
  export declare class CameraManager {
3
3
  readonly camera: PerspectiveCamera;
4
- private dragging;
5
- private target;
4
+ initialDistance: number;
5
+ private minDistance;
6
+ private maxDistance;
7
+ private initialFOV;
8
+ private fov;
9
+ private minFOV;
10
+ private maxFOV;
11
+ private targetFOV;
12
+ private minPolarAngle;
13
+ private maxPolarAngle;
14
+ private dampingFactor;
6
15
  private targetDistance;
7
- private maxTargetDistance;
8
16
  private distance;
9
17
  private targetPhi;
10
18
  private phi;
11
19
  private targetTheta;
12
20
  private theta;
21
+ private dragging;
22
+ private target;
13
23
  private hadTarget;
14
24
  constructor();
15
25
  private onResize;
@@ -10,6 +10,7 @@ export type CharacterDescription = {
10
10
  idleAnimationFileUrl: string;
11
11
  jogAnimationFileUrl: string;
12
12
  sprintAnimationFileUrl: string;
13
+ airAnimationFileUrl: string;
13
14
  modelScale: number;
14
15
  };
15
16
  export declare class Character {
@@ -1,5 +1,5 @@
1
1
  import { PositionAndRotation } from "mml-web";
2
- import { Group } from "three";
2
+ import { Group, Vector3 } from "three";
3
3
  import { CameraManager } from "../camera/CameraManager";
4
4
  import { CollisionsManager } from "../collisions/CollisionsManager";
5
5
  import { KeyInputManager } from "../input/KeyInputManager";
@@ -22,7 +22,7 @@ export declare class CharacterManager {
22
22
  character: Character | null;
23
23
  readonly group: Group;
24
24
  constructor(collisionsManager: CollisionsManager, cameraManager: CameraManager, timeManager: TimeManager, inputManager: KeyInputManager, clientStates: Map<number, CharacterState>, sendUpdate: (update: CharacterState) => void);
25
- spawnCharacter(characterDescription: CharacterDescription, id: number, isLocal?: boolean): Promise<Character>;
25
+ spawnCharacter(characterDescription: CharacterDescription, id: number, isLocal?: boolean, spawnPosition?: Vector3): Promise<Character>;
26
26
  getLocalCharacterPositionAndRotation(): PositionAndRotation;
27
27
  clear(): void;
28
28
  update(): void;
@@ -17,10 +17,20 @@ export declare class LocalController {
17
17
  radius: number;
18
18
  segment: Line3;
19
19
  };
20
+ private maxWalkSpeed;
21
+ private maxRunSpeed;
22
+ private gravity;
23
+ private jumpForce;
24
+ private coyoteTimeThreshold;
25
+ private coyoteTime;
26
+ private canJump;
20
27
  private characterOnGround;
28
+ private characterWasOnGround;
29
+ private characterAirborneSince;
30
+ private currentHeight;
21
31
  private characterVelocity;
22
- private gravity;
23
- private upVector;
32
+ private vectorUp;
33
+ private vectorDown;
24
34
  private rotationOffset;
25
35
  private azimuthalAngle;
26
36
  private tempBox;
@@ -28,11 +38,15 @@ export declare class LocalController {
28
38
  private tempSegment;
29
39
  private tempVector;
30
40
  private tempVector2;
31
- private jumpInput;
32
- private jumpForce;
33
- private canJump;
34
- private inputDirections;
35
- private runInput;
41
+ private rayCaster;
42
+ private forward;
43
+ private backward;
44
+ private left;
45
+ private right;
46
+ private run;
47
+ private jump;
48
+ private anyDirection;
49
+ private conflictingDirections;
36
50
  private thirdPersonCamera;
37
51
  private speed;
38
52
  private targetSpeed;
@@ -1,9 +1,14 @@
1
1
  import { AnimationClip, Object3D } from "three";
2
2
  export declare class ModelLoader {
3
- private debug;
3
+ private static instance;
4
4
  private readonly loadingManager;
5
- private readonly fbxLoader;
6
5
  private readonly gltfLoader;
7
- constructor();
6
+ private modelCache;
7
+ private ongoingLoads;
8
+ constructor(maxCacheSize?: number);
9
+ static getInstance(): ModelLoader;
8
10
  load(fileUrl: string, fileType: "model" | "animation"): Promise<Object3D | AnimationClip | undefined>;
11
+ private loadFromUrl;
9
12
  }
13
+ declare const MODEL_LOADER: ModelLoader;
14
+ export default MODEL_LOADER;
@@ -4,17 +4,15 @@ import { AnimationState, CharacterState } from "./CharacterState";
4
4
  export declare class RemoteController {
5
5
  readonly character: Character;
6
6
  readonly id: number;
7
+ private modelLoader;
7
8
  characterModel: Object3D | null;
8
- private loadManager;
9
9
  private animationMixer;
10
10
  private animations;
11
11
  currentAnimation: AnimationState;
12
- private fbxLoader;
13
- private gltfLoader;
14
12
  networkState: CharacterState;
15
13
  constructor(character: Character, id: number);
16
14
  update(clientUpdate: CharacterState, time: number, deltaTime: number): void;
17
- setAnimationFromFile(animationType: AnimationState, fileName: string): void;
15
+ setAnimationFromFile(animationType: AnimationState, fileName: string): Promise<void>;
18
16
  private transitionToAnimation;
19
17
  private updateFromNetwork;
20
18
  }
@@ -7,7 +7,11 @@ export declare class CollisionsManager {
7
7
  private tempVector2;
8
8
  private collisionMeshState;
9
9
  private collisionTrigger;
10
+ colliders: Group;
11
+ private collisionEnabledMeshes;
10
12
  constructor(scene: Scene);
13
+ private safeAddColliders;
14
+ private removeFromColliders;
11
15
  private createCollisionMeshState;
12
16
  addMeshesGroup(group: Group, mElement?: MElement): void;
13
17
  updateMeshesGroup(group: Group): void;
@@ -2,3 +2,5 @@ import { Vector3 } from "three";
2
2
  export declare const getSpawnPositionInsideCircle: (radius: number, positions: number, id: number, yPos?: number) => Vector3;
3
3
  export declare const round: (n: number, digits: number) => number;
4
4
  export declare const ease: (target: number, n: number, factor: number) => number;
5
+ export declare function clamp(value: number, min: number, max: number): number;
6
+ export declare const remap: (value: number, minValue: number, maxValue: number, minScaledValue: number, maxScaledValue: number) => number;