hytopia 0.4.4 → 0.5.0-dev
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/docs/server.collider.md +1 -1
- package/docs/server.collider.optionsfrommodeluri.md +18 -2
- package/docs/server.collideroptions.md +2 -2
- package/docs/server.collidershape.md +14 -0
- package/docs/server.defaultplayerentity._constructor_.md +47 -0
- package/docs/server.defaultplayerentity.md +61 -0
- package/docs/server.defaultplayerentitycontroller._constructor_.md +49 -0
- package/docs/{server.playerentitycontroller.attach.md → server.defaultplayerentitycontroller.attach.md} +2 -2
- package/docs/server.defaultplayerentitycontroller.autocancelmouseleftclick.md +13 -0
- package/docs/server.defaultplayerentitycontroller.canjump.md +13 -0
- package/docs/server.defaultplayerentitycontroller.canrun.md +13 -0
- package/docs/server.defaultplayerentitycontroller.canwalk.md +13 -0
- package/docs/server.defaultplayerentitycontroller.idleloopedanimations.md +13 -0
- package/docs/server.defaultplayerentitycontroller.interactoneshotanimations.md +13 -0
- package/docs/server.defaultplayerentitycontroller.isgrounded.md +13 -0
- package/docs/server.defaultplayerentitycontroller.isonplatform.md +13 -0
- package/docs/server.defaultplayerentitycontroller.isswimming.md +13 -0
- package/docs/server.defaultplayerentitycontroller.jumponeshotanimations.md +13 -0
- package/docs/server.defaultplayerentitycontroller.jumpvelocity.md +13 -0
- package/docs/server.defaultplayerentitycontroller.md +599 -0
- package/docs/server.defaultplayerentitycontroller.platform.md +13 -0
- package/docs/server.defaultplayerentitycontroller.runloopedanimations.md +13 -0
- package/docs/server.defaultplayerentitycontroller.runvelocity.md +13 -0
- package/docs/server.defaultplayerentitycontroller.spawn.md +53 -0
- package/docs/server.defaultplayerentitycontroller.stickstoplatforms.md +13 -0
- package/docs/server.defaultplayerentitycontroller.swimfastvelocity.md +13 -0
- package/docs/server.defaultplayerentitycontroller.swimgravity.md +13 -0
- package/docs/server.defaultplayerentitycontroller.swimloopedanimations.md +13 -0
- package/docs/server.defaultplayerentitycontroller.swimmaxgravityvelocity.md +13 -0
- package/docs/server.defaultplayerentitycontroller.swimslowvelocity.md +13 -0
- package/docs/server.defaultplayerentitycontroller.swimupwardvelocity.md +13 -0
- package/docs/{server.playerentitycontroller.tickwithplayerinput.md → server.defaultplayerentitycontroller.tickwithplayerinput.md} +2 -2
- package/docs/server.defaultplayerentitycontroller.walkloopedanimations.md +13 -0
- package/docs/server.defaultplayerentitycontroller.walkvelocity.md +13 -0
- package/docs/server.defaultplayerentitycontrolleroptions.autocancelmouseleftclick.md +13 -0
- package/docs/server.defaultplayerentitycontrolleroptions.canjump.md +13 -0
- package/docs/server.defaultplayerentitycontrolleroptions.canrun.md +13 -0
- package/docs/server.defaultplayerentitycontrolleroptions.canwalk.md +13 -0
- package/docs/server.defaultplayerentitycontrolleroptions.idleloopedanimations.md +13 -0
- package/docs/server.defaultplayerentitycontrolleroptions.interactoneshotanimations.md +13 -0
- package/docs/server.defaultplayerentitycontrolleroptions.jumponeshotanimations.md +13 -0
- package/docs/server.defaultplayerentitycontrolleroptions.jumpvelocity.md +13 -0
- package/docs/server.defaultplayerentitycontrolleroptions.md +399 -0
- package/docs/server.defaultplayerentitycontrolleroptions.runloopedanimations.md +13 -0
- package/docs/server.defaultplayerentitycontrolleroptions.runvelocity.md +13 -0
- package/docs/server.defaultplayerentitycontrolleroptions.stickstoplatforms.md +13 -0
- package/docs/server.defaultplayerentitycontrolleroptions.swimfastvelocity.md +13 -0
- package/docs/server.defaultplayerentitycontrolleroptions.swimgravity.md +13 -0
- package/docs/server.defaultplayerentitycontrolleroptions.swimloopedanimations.md +13 -0
- package/docs/server.defaultplayerentitycontrolleroptions.swimmaxgravityvelocity.md +13 -0
- package/docs/server.defaultplayerentitycontrolleroptions.swimslowvelocity.md +13 -0
- package/docs/server.defaultplayerentitycontrolleroptions.swimupwardvelocity.md +13 -0
- package/docs/server.defaultplayerentitycontrolleroptions.walkloopedanimations.md +13 -0
- package/docs/server.defaultplayerentitycontrolleroptions.walkvelocity.md +13 -0
- package/docs/server.defaultplayerentityoptions.md +15 -0
- package/docs/server.entity.md +21 -0
- package/docs/server.entity.modelpreferredshape.md +13 -0
- package/docs/server.md +77 -22
- package/docs/server.modelboundingbox.md +18 -0
- package/docs/server.modelentityoptions.md +19 -0
- package/docs/server.modelentityoptions.modelpreferredshape.md +13 -0
- package/docs/server.modelregistry.getboundingbox.md +1 -1
- package/docs/server.modelregistry.gettrimesh.md +71 -0
- package/docs/server.modelregistry.md +14 -0
- package/docs/server.modeltrimesh.md +16 -0
- package/docs/server.playerentity.md +1 -1
- package/docs/server.wedgecollideroptions.extents.md +13 -0
- package/docs/server.wedgecollideroptions.md +75 -0
- package/docs/server.wedgecollideroptions.shape.md +11 -0
- package/examples/ai-agents/index.ts +2 -6
- package/examples/big-world/index.ts +2 -5
- package/examples/block-entity/index.ts +2 -5
- package/examples/child-entity/index.ts +2 -5
- package/examples/custom-ui/index.ts +3 -6
- package/examples/entity-controller/index.ts +2 -5
- package/examples/entity-spawn/index.ts +2 -5
- package/examples/hole-in-wall-game/index.ts +8 -9
- package/examples/hygrounds/classes/GameManager.ts +1 -0
- package/examples/hygrounds/classes/GamePlayerEntity.ts +5 -6
- package/examples/lighting/index.ts +3 -6
- package/examples/mobile-controls/index.ts +2 -5
- package/examples/pathfinding/index.ts +2 -5
- package/examples/payload-game/index.ts +15 -17
- package/examples/player-persistence/index.ts +2 -5
- package/examples/wall-dodge-game/index.ts +8 -11
- package/examples/zombies-fps/classes/GamePlayerEntity.ts +5 -8
- package/package.json +1 -1
- package/server.api.json +10133 -9310
- package/server.d.ts +236 -146
- package/server.js +143 -129
- package/docs/server.playerentitycontroller._constructor_.md +0 -49
- package/docs/server.playerentitycontroller.autocancelmouseleftclick.md +0 -13
- package/docs/server.playerentitycontroller.canjump.md +0 -13
- package/docs/server.playerentitycontroller.canrun.md +0 -13
- package/docs/server.playerentitycontroller.canwalk.md +0 -13
- package/docs/server.playerentitycontroller.idleloopedanimations.md +0 -13
- package/docs/server.playerentitycontroller.interactoneshotanimations.md +0 -13
- package/docs/server.playerentitycontroller.isgrounded.md +0 -13
- package/docs/server.playerentitycontroller.isonplatform.md +0 -13
- package/docs/server.playerentitycontroller.jumponeshotanimations.md +0 -13
- package/docs/server.playerentitycontroller.jumpvelocity.md +0 -13
- package/docs/server.playerentitycontroller.md +0 -464
- package/docs/server.playerentitycontroller.platform.md +0 -13
- package/docs/server.playerentitycontroller.runloopedanimations.md +0 -13
- package/docs/server.playerentitycontroller.runvelocity.md +0 -13
- package/docs/server.playerentitycontroller.spawn.md +0 -53
- package/docs/server.playerentitycontroller.stickstoplatforms.md +0 -13
- package/docs/server.playerentitycontroller.walkloopedanimations.md +0 -13
- package/docs/server.playerentitycontroller.walkvelocity.md +0 -13
- package/docs/server.playerentitycontrolleroptions.autocancelmouseleftclick.md +0 -13
- package/docs/server.playerentitycontrolleroptions.canjump.md +0 -13
- package/docs/server.playerentitycontrolleroptions.canrun.md +0 -13
- package/docs/server.playerentitycontrolleroptions.canwalk.md +0 -13
- package/docs/server.playerentitycontrolleroptions.idleloopedanimations.md +0 -13
- package/docs/server.playerentitycontrolleroptions.interactoneshotanimations.md +0 -13
- package/docs/server.playerentitycontrolleroptions.jumponeshotanimations.md +0 -13
- package/docs/server.playerentitycontrolleroptions.jumpvelocity.md +0 -13
- package/docs/server.playerentitycontrolleroptions.md +0 -285
- package/docs/server.playerentitycontrolleroptions.runloopedanimations.md +0 -13
- package/docs/server.playerentitycontrolleroptions.runvelocity.md +0 -13
- package/docs/server.playerentitycontrolleroptions.stickstoplatforms.md +0 -13
- package/docs/server.playerentitycontrolleroptions.walkloopedanimations.md +0 -13
- package/docs/server.playerentitycontrolleroptions.walkvelocity.md +0 -13
package/server.d.ts
CHANGED
@@ -1094,9 +1094,11 @@ export declare class Collider extends EventRouter {
|
|
1094
1094
|
/**
|
1095
1095
|
* Creates a collider options object from a modelUri with best approximate shape and size.
|
1096
1096
|
* @param modelUri - The URI of the model.
|
1097
|
+
* @param scale - The scale of the model.
|
1098
|
+
* @param preferredShape - The preferred shape to use for the collider.
|
1097
1099
|
* @returns The collider options object.
|
1098
1100
|
*/
|
1099
|
-
static optionsFromModelUri(modelUri: string, scale?: number): ColliderOptions;
|
1101
|
+
static optionsFromModelUri(modelUri: string, scale?: number, preferredShape?: ColliderShape): ColliderOptions;
|
1100
1102
|
/** The bounciness of the collider. */
|
1101
1103
|
get bounciness(): number;
|
1102
1104
|
/** The bounciness combine rule of the collider. */
|
@@ -1221,15 +1223,16 @@ export declare class Collider extends EventRouter {
|
|
1221
1223
|
removeFromSimulation(): void;
|
1222
1224
|
|
1223
1225
|
|
1226
|
+
private _buildWedgeConvexHullVertices;
|
1227
|
+
|
1228
|
+
|
1224
1229
|
|
1225
1230
|
|
1226
|
-
private _requireUnsimulated;
|
1227
|
-
private _requireNotRemoved;
|
1228
1231
|
|
1229
1232
|
}
|
1230
1233
|
|
1231
1234
|
/** The options for a collider. @public */
|
1232
|
-
export declare type ColliderOptions = BallColliderOptions | BlockColliderOptions | CapsuleColliderOptions | ConeColliderOptions | CylinderColliderOptions | RoundCylinderColliderOptions | TrimeshColliderOptions | NoneColliderOptions;
|
1235
|
+
export declare type ColliderOptions = BallColliderOptions | BlockColliderOptions | CapsuleColliderOptions | ConeColliderOptions | CylinderColliderOptions | RoundCylinderColliderOptions | TrimeshColliderOptions | WedgeColliderOptions | NoneColliderOptions;
|
1233
1236
|
|
1234
1237
|
/** The shapes a collider can be. @public */
|
1235
1238
|
export declare enum ColliderShape {
|
@@ -1240,7 +1243,8 @@ export declare enum ColliderShape {
|
|
1240
1243
|
CONE = "cone",
|
1241
1244
|
CYLINDER = "cylinder",
|
1242
1245
|
ROUND_CYLINDER = "round-cylinder",
|
1243
|
-
TRIMESH = "trimesh"
|
1246
|
+
TRIMESH = "trimesh",
|
1247
|
+
WEDGE = "wedge"
|
1244
1248
|
}
|
1245
1249
|
|
1246
1250
|
/**
|
@@ -1411,6 +1415,197 @@ export declare type DecodedCollisionGroups = {
|
|
1411
1415
|
/** The default rigid body options for a model entity when EntityOptions.rigidBodyOptions is not provided. @public */
|
1412
1416
|
export declare const DEFAULT_ENTITY_RIGID_BODY_OPTIONS: RigidBodyOptions;
|
1413
1417
|
|
1418
|
+
/**
|
1419
|
+
* Represents the default player model entity.
|
1420
|
+
*
|
1421
|
+
* @remarks
|
1422
|
+
* The default player entity extends the {@link PlayerEntity} class,
|
1423
|
+
* uses the default player model, and assigns a DefaultPlayerEntityController.
|
1424
|
+
* This entity is the most commonly used player controlled entity in games.
|
1425
|
+
* It automatically handles things like managing player visual customizations
|
1426
|
+
* and cosmetics, and more. If you want to change the default model used, you
|
1427
|
+
* can override all of the defaults, including the modelUri, but you must
|
1428
|
+
* ensure that the model used has the same animation names and anchor points
|
1429
|
+
* as the default player model in order to prevent unexpected behavior.
|
1430
|
+
*
|
1431
|
+
* @example
|
1432
|
+
* ```typescript
|
1433
|
+
* const playerEntity = new DefaultPlayerEntity({ player });
|
1434
|
+
*
|
1435
|
+
* playerEntity.spawn(world, { x: 0, y: 10, z: 0 });
|
1436
|
+
* ```
|
1437
|
+
*
|
1438
|
+
* @public
|
1439
|
+
*/
|
1440
|
+
export declare class DefaultPlayerEntity extends PlayerEntity {
|
1441
|
+
constructor(options: DefaultPlayerEntityOptions);
|
1442
|
+
}
|
1443
|
+
|
1444
|
+
/**
|
1445
|
+
* The player entity controller implementation.
|
1446
|
+
*
|
1447
|
+
* @remarks
|
1448
|
+
* This class extends {@link BaseEntityController}
|
1449
|
+
* and implements the default movement, platforming, jump,
|
1450
|
+
* swimming, and other basic logic for the
|
1451
|
+
* default player entity. We recommend you extend this class
|
1452
|
+
* if you'd like to implement additional logic on top of the
|
1453
|
+
* DefaultPlayerEntityController implementation.
|
1454
|
+
*
|
1455
|
+
* @example
|
1456
|
+
* ```typescript
|
1457
|
+
* // Create a custom entity controller for myEntity, prior to spawning it.
|
1458
|
+
* myEntity.setController(new DefaultPlayerEntityController({
|
1459
|
+
* jumpVelocity: 10,
|
1460
|
+
* runVelocity: 8,
|
1461
|
+
* walkVelocity: 4,
|
1462
|
+
* }));
|
1463
|
+
*
|
1464
|
+
* // Spawn the entity in the world.
|
1465
|
+
* myEntity.spawn(world, { x: 53, y: 10, z: 23 });
|
1466
|
+
* ```
|
1467
|
+
*
|
1468
|
+
* @public
|
1469
|
+
*/
|
1470
|
+
export declare class DefaultPlayerEntityController extends BaseEntityController {
|
1471
|
+
/** Whether to automatically cancel left click input after first processed tick, defaults to true. */
|
1472
|
+
autoCancelMouseLeftClick: boolean;
|
1473
|
+
/**
|
1474
|
+
* A function allowing custom logic to determine if the entity can walk.
|
1475
|
+
* @param controller - The default player entity controller instance.
|
1476
|
+
* @returns Whether the entity of the entity controller can walk.
|
1477
|
+
*/
|
1478
|
+
canWalk: (controller: DefaultPlayerEntityController) => boolean;
|
1479
|
+
/**
|
1480
|
+
* A function allowing custom logic to determine if the entity can run.
|
1481
|
+
* @param controller - The default player entity controller instance.
|
1482
|
+
* @returns Whether the entity of the entity controller can run.
|
1483
|
+
*/
|
1484
|
+
canRun: (controller: DefaultPlayerEntityController) => boolean;
|
1485
|
+
/**
|
1486
|
+
* A function allowing custom logic to determine if the entity can jump.
|
1487
|
+
* @param controller - The default player entity controller instance.
|
1488
|
+
* @returns Whether the entity of the entity controller can jump.
|
1489
|
+
*/
|
1490
|
+
canJump: (controller: DefaultPlayerEntityController) => boolean;
|
1491
|
+
/** The looped animation(s) that will play when the entity is idle. */
|
1492
|
+
idleLoopedAnimations: string[];
|
1493
|
+
/** The oneshot animation(s) that will play when the entity interacts (left click) */
|
1494
|
+
interactOneshotAnimations: string[];
|
1495
|
+
/** The oneshot animation(s) that will play when the entity is jumping. */
|
1496
|
+
jumpOneshotAnimations: string[];
|
1497
|
+
/** The upward velocity applied to the entity when it jumps. */
|
1498
|
+
jumpVelocity: number;
|
1499
|
+
/** The looped animation(s) that will play when the entity is running. */
|
1500
|
+
runLoopedAnimations: string[];
|
1501
|
+
/** The normalized horizontal velocity applied to the entity when it runs. */
|
1502
|
+
runVelocity: number;
|
1503
|
+
/** Whether the entity sticks to platforms. */
|
1504
|
+
sticksToPlatforms: boolean;
|
1505
|
+
/** The normalized horizontal velocity applied to the entity when it swims fast (equivalent to running). */
|
1506
|
+
swimFastVelocity: number;
|
1507
|
+
/** The gravity modifier applied to the entity when swimming. */
|
1508
|
+
swimGravity: number;
|
1509
|
+
/** The looped animation(s) that will play when the entity is swimming. */
|
1510
|
+
swimLoopedAnimations: string[];
|
1511
|
+
/** The maximum downward velocity that the entity can reach when affected by gravity while swimming. */
|
1512
|
+
swimMaxGravityVelocity: number;
|
1513
|
+
/** The normalized horizontal velocity applied to the entity when it swims slowly (equivalent to walking). */
|
1514
|
+
swimSlowVelocity: number;
|
1515
|
+
/** The upward velocity applied to the entity when swimming. */
|
1516
|
+
swimUpwardVelocity: number;
|
1517
|
+
/** The looped animation(s) that will play when the entity is walking. */
|
1518
|
+
walkLoopedAnimations: string[];
|
1519
|
+
/** The normalized horizontal velocity applied to the entity when it walks. */
|
1520
|
+
walkVelocity: number;
|
1521
|
+
|
1522
|
+
|
1523
|
+
|
1524
|
+
|
1525
|
+
|
1526
|
+
/**
|
1527
|
+
* @param options - Options for the controller.
|
1528
|
+
*/
|
1529
|
+
constructor(options?: DefaultPlayerEntityControllerOptions);
|
1530
|
+
/** Whether the entity is grounded. */
|
1531
|
+
get isGrounded(): boolean;
|
1532
|
+
/** Whether the entity is on a platform, a platform is any entity with a kinematic rigid body. */
|
1533
|
+
get isOnPlatform(): boolean;
|
1534
|
+
/** Whether the entity is swimming, this is determined by if the entity is in a liquid block. */
|
1535
|
+
get isSwimming(): boolean;
|
1536
|
+
/** The platform the entity is on, if any. */
|
1537
|
+
get platform(): Entity | undefined;
|
1538
|
+
/**
|
1539
|
+
* Called when the controller is attached to an entity.
|
1540
|
+
* @param entity - The entity to attach the controller to.
|
1541
|
+
*/
|
1542
|
+
attach(entity: Entity): void;
|
1543
|
+
/**
|
1544
|
+
* Called when the controlled entity is spawned.
|
1545
|
+
* In DefaultPlayerEntityController, this function is used to create
|
1546
|
+
* the colliders for the entity for wall and ground detection.
|
1547
|
+
* @param entity - The entity that is spawned.
|
1548
|
+
*/
|
1549
|
+
spawn(entity: Entity): void;
|
1550
|
+
/**
|
1551
|
+
* Ticks the player movement for the entity controller,
|
1552
|
+
* overriding the default implementation. If the entity to tick
|
1553
|
+
* is a child entity, only the event will be emitted but the default
|
1554
|
+
* movement logic will not be applied.
|
1555
|
+
*
|
1556
|
+
* @param entity - The entity to tick.
|
1557
|
+
* @param input - The current input state of the player.
|
1558
|
+
* @param cameraOrientation - The current camera orientation state of the player.
|
1559
|
+
* @param deltaTimeMs - The delta time in milliseconds since the last tick.
|
1560
|
+
*/
|
1561
|
+
tickWithPlayerInput(entity: PlayerEntity, input: PlayerInput, cameraOrientation: PlayerCameraOrientation, deltaTimeMs: number): void;
|
1562
|
+
}
|
1563
|
+
|
1564
|
+
/** Options for creating a DefaultPlayerEntityController instance. @public */
|
1565
|
+
export declare interface DefaultPlayerEntityControllerOptions {
|
1566
|
+
/** Whether to automatically cancel left click input after first processed tick, defaults to true. */
|
1567
|
+
autoCancelMouseLeftClick?: boolean;
|
1568
|
+
/** A function allowing custom logic to determine if the entity can jump. */
|
1569
|
+
canJump?: () => boolean;
|
1570
|
+
/** A function allowing custom logic to determine if the entity can walk. */
|
1571
|
+
canWalk?: () => boolean;
|
1572
|
+
/** A function allowing custom logic to determine if the entity can run. */
|
1573
|
+
canRun?: () => boolean;
|
1574
|
+
/** Overrides the animation(s) that will play when the entity is idle. */
|
1575
|
+
idleLoopedAnimations?: string[];
|
1576
|
+
/** Overrides the animation(s) that will play when the entity interacts (left click) */
|
1577
|
+
interactOneshotAnimations?: string[];
|
1578
|
+
/** Overrides the animation(s) that will play when the entity is jumping. */
|
1579
|
+
jumpOneshotAnimations?: string[];
|
1580
|
+
/** The upward velocity applied to the entity when it jumps. */
|
1581
|
+
jumpVelocity?: number;
|
1582
|
+
/** The normalized horizontal velocity applied to the entity when it runs. */
|
1583
|
+
runVelocity?: number;
|
1584
|
+
/** Overrides the animation(s) that will play when the entity is running. */
|
1585
|
+
runLoopedAnimations?: string[];
|
1586
|
+
/** Whether the entity sticks to platforms, defaults to true. */
|
1587
|
+
sticksToPlatforms?: boolean;
|
1588
|
+
/** The normalized horizontal velocity applied to the entity when it swims fast (equivalent to running). */
|
1589
|
+
swimFastVelocity?: number;
|
1590
|
+
/** The gravity modifier applied to the entity when swimming. */
|
1591
|
+
swimGravity?: number;
|
1592
|
+
/** The maximum downward velocity that the entity can reach when affected by gravity while swimming. */
|
1593
|
+
swimMaxGravityVelocity?: number;
|
1594
|
+
/** The looped animation(s) that will play when the entity is swimming. */
|
1595
|
+
swimLoopedAnimations?: string[];
|
1596
|
+
/** The normalized horizontal velocity applied to the entity when it swims slowly (equivalent to walking). */
|
1597
|
+
swimSlowVelocity?: number;
|
1598
|
+
/** The upward velocity applied to the entity when swimming. */
|
1599
|
+
swimUpwardVelocity?: number;
|
1600
|
+
/** Overrides the animation(s) that will play when the entity is walking. */
|
1601
|
+
walkLoopedAnimations?: string[];
|
1602
|
+
/** The normalized horizontal velocity applied to the entity when it walks. */
|
1603
|
+
walkVelocity?: number;
|
1604
|
+
}
|
1605
|
+
|
1606
|
+
/** Options for creating a DefaultPlayerEntity instance. @public */
|
1607
|
+
export declare type DefaultPlayerEntityOptions = {} & PlayerEntityOptions;
|
1608
|
+
|
1414
1609
|
/** The options for a dynamic rigid body, also the default type. @public */
|
1415
1610
|
export declare interface DynamicRigidBodyOptions extends BaseRigidBodyOptions {
|
1416
1611
|
type?: RigidBodyType.DYNAMIC;
|
@@ -1504,6 +1699,7 @@ export declare class Entity extends RigidBody implements protocol.Serializable {
|
|
1504
1699
|
|
1505
1700
|
|
1506
1701
|
|
1702
|
+
|
1507
1703
|
|
1508
1704
|
/**
|
1509
1705
|
* @param options - The options for the entity.
|
@@ -1525,6 +1721,8 @@ export declare class Entity extends RigidBody implements protocol.Serializable {
|
|
1525
1721
|
get modelHiddenNodes(): ReadonlySet<string>;
|
1526
1722
|
/** The looped animations to start when the entity is spawned. */
|
1527
1723
|
get modelLoopedAnimations(): ReadonlySet<string>;
|
1724
|
+
/** The preferred shape of the entity's model when automatically generating its collider when no explicit colliders are provided. */
|
1725
|
+
get modelPreferredShape(): ColliderShape | undefined;
|
1528
1726
|
/** The scale of the entity's model. */
|
1529
1727
|
get modelScale(): number | undefined;
|
1530
1728
|
/** The URI or path to the .gltf model asset to be used for the entity. */
|
@@ -2944,7 +3142,7 @@ export declare class Matrix4 extends Float32Array {
|
|
2944
3142
|
}
|
2945
3143
|
|
2946
3144
|
/** A bounding box for a model. @public */
|
2947
|
-
declare type ModelBoundingBox = {
|
3145
|
+
export declare type ModelBoundingBox = {
|
2948
3146
|
min: Vector3Like;
|
2949
3147
|
max: Vector3Like;
|
2950
3148
|
};
|
@@ -2957,6 +3155,8 @@ export declare interface ModelEntityOptions extends BaseEntityOptions {
|
|
2957
3155
|
modelHiddenNodes?: string[];
|
2958
3156
|
/** The looped animations to start when the entity is spawned. */
|
2959
3157
|
modelLoopedAnimations?: string[];
|
3158
|
+
/** The preferred shape of the entity's model when automatically generating its collider when no explicit colliders are provided. */
|
3159
|
+
modelPreferredShape?: ColliderShape;
|
2960
3160
|
/** The scale of the entity's model. */
|
2961
3161
|
modelScale?: number;
|
2962
3162
|
/** The URI or path to the .gltf model asset to be used for the entity. */
|
@@ -2993,6 +3193,7 @@ export declare class ModelRegistry {
|
|
2993
3193
|
|
2994
3194
|
|
2995
3195
|
|
3196
|
+
|
2996
3197
|
/**
|
2997
3198
|
* Retrieves the bounding box of a model.
|
2998
3199
|
*
|
@@ -3014,6 +3215,14 @@ export declare class ModelRegistry {
|
|
3014
3215
|
* @returns The names of all nodes in the model.
|
3015
3216
|
*/
|
3016
3217
|
getNodeNames(modelUri: string): string[];
|
3218
|
+
/**
|
3219
|
+
* Retrieves the trimesh of a model.
|
3220
|
+
*
|
3221
|
+
* @param modelUri - The URI of the model to retrieve the trimesh for.
|
3222
|
+
* @param scale - Optional uniform scaling to apply to the trimesh. Defaults to 1, which is no scaling.
|
3223
|
+
* @returns The trimesh of the model.
|
3224
|
+
*/
|
3225
|
+
getTrimesh(modelUri: string, scale?: number): ModelTrimesh | undefined;
|
3017
3226
|
/**
|
3018
3227
|
* Checks if a model has a node with the given name.
|
3019
3228
|
*
|
@@ -3030,8 +3239,15 @@ export declare class ModelRegistry {
|
|
3030
3239
|
|
3031
3240
|
|
3032
3241
|
|
3242
|
+
|
3033
3243
|
}
|
3034
3244
|
|
3245
|
+
/** A trimesh for a model. @public */
|
3246
|
+
export declare type ModelTrimesh = {
|
3247
|
+
vertices: Float32Array;
|
3248
|
+
indices: Uint32Array;
|
3249
|
+
};
|
3250
|
+
|
3035
3251
|
/**
|
3036
3252
|
* A callback function called when the entity associated with the
|
3037
3253
|
* SimpleEntityController updates its position as it is
|
@@ -3561,12 +3777,13 @@ export declare type PlayerCameraOrientation = {
|
|
3561
3777
|
*
|
3562
3778
|
* @remarks
|
3563
3779
|
* Player entities extend the {@link Entity} class.
|
3564
|
-
* They can be created and assigned to a player
|
3565
|
-
*
|
3566
|
-
*
|
3567
|
-
*
|
3568
|
-
*
|
3569
|
-
*
|
3780
|
+
* They can be created and assigned to a player at
|
3781
|
+
* anytime during gameplay, but most commonly when
|
3782
|
+
* a player joins a world. PlayerEntity expects
|
3783
|
+
* a controller to be set prior to spawning.
|
3784
|
+
* Without setting a controller, the player entity
|
3785
|
+
* will not respond to player inputs and throw an
|
3786
|
+
* error.
|
3570
3787
|
*
|
3571
3788
|
* @example
|
3572
3789
|
* ```typescript
|
@@ -3598,140 +3815,6 @@ export declare class PlayerEntity extends Entity {
|
|
3598
3815
|
|
3599
3816
|
}
|
3600
3817
|
|
3601
|
-
/**
|
3602
|
-
* The player entity controller implementation.
|
3603
|
-
*
|
3604
|
-
* @remarks
|
3605
|
-
* This class extends {@link BaseEntityController}
|
3606
|
-
* and implements the default movement logic for a
|
3607
|
-
* entity. This is used as the default for
|
3608
|
-
* players when they join your game. This class may be extended
|
3609
|
-
* if you'd like to implement additional logic on top of the
|
3610
|
-
* PlayerEntityController implementation.
|
3611
|
-
*
|
3612
|
-
* @example
|
3613
|
-
* ```typescript
|
3614
|
-
* // Create a custom entity controller for myEntity, prior to spawning it.
|
3615
|
-
* myEntity.setController(new PlayerEntityController(myEntity, {
|
3616
|
-
* jumpVelocity: 10,
|
3617
|
-
* runVelocity: 8,
|
3618
|
-
* walkVelocity: 4,
|
3619
|
-
* }));
|
3620
|
-
*
|
3621
|
-
* // Spawn the entity in the world.
|
3622
|
-
* myEntity.spawn(world, { x: 53, y: 10, z: 23 });
|
3623
|
-
* ```
|
3624
|
-
*
|
3625
|
-
* @public
|
3626
|
-
*/
|
3627
|
-
export declare class PlayerEntityController extends BaseEntityController {
|
3628
|
-
/** Whether to automatically cancel left click input after first processed tick, defaults to true. */
|
3629
|
-
autoCancelMouseLeftClick: boolean;
|
3630
|
-
/**
|
3631
|
-
* A function allowing custom logic to determine if the entity can walk.
|
3632
|
-
* @param playerEntityController - The entity controller instance.
|
3633
|
-
* @returns Whether the entity of the entity controller can walk.
|
3634
|
-
*/
|
3635
|
-
canWalk: (playerEntityController: PlayerEntityController) => boolean;
|
3636
|
-
/**
|
3637
|
-
* A function allowing custom logic to determine if the entity can run.
|
3638
|
-
* @param playerEntityController - The entity controller instance.
|
3639
|
-
* @returns Whether the entity of the entity controller can run.
|
3640
|
-
*/
|
3641
|
-
canRun: (playerEntityController: PlayerEntityController) => boolean;
|
3642
|
-
/**
|
3643
|
-
* A function allowing custom logic to determine if the entity can jump.
|
3644
|
-
* @param playerEntityController - The entity controller instance.
|
3645
|
-
* @returns Whether the entity of the entity controller can jump.
|
3646
|
-
*/
|
3647
|
-
canJump: (playerEntityController: PlayerEntityController) => boolean;
|
3648
|
-
/** The looped animation(s) that will play when the entity is idle. */
|
3649
|
-
idleLoopedAnimations: string[];
|
3650
|
-
/** The oneshot animation(s) that will play when the entity interacts (left click) */
|
3651
|
-
interactOneshotAnimations: string[];
|
3652
|
-
/** The oneshot animation(s) that will play when the entity is jumping. */
|
3653
|
-
jumpOneshotAnimations: string[];
|
3654
|
-
/** The upward velocity applied to the entity when it jumps. */
|
3655
|
-
jumpVelocity: number;
|
3656
|
-
/** The looped animation(s) that will play when the entity is running. */
|
3657
|
-
runLoopedAnimations: string[];
|
3658
|
-
/** The normalized horizontal velocity applied to the entity when it runs. */
|
3659
|
-
runVelocity: number;
|
3660
|
-
/** Whether the entity sticks to platforms. */
|
3661
|
-
sticksToPlatforms: boolean;
|
3662
|
-
/** The looped animation(s) that will play when the entity is walking. */
|
3663
|
-
walkLoopedAnimations: string[];
|
3664
|
-
/** The normalized horizontal velocity applied to the entity when it walks. */
|
3665
|
-
walkVelocity: number;
|
3666
|
-
|
3667
|
-
|
3668
|
-
|
3669
|
-
/**
|
3670
|
-
* @param options - Options for the controller.
|
3671
|
-
*/
|
3672
|
-
constructor(options?: PlayerEntityControllerOptions);
|
3673
|
-
/** Whether the entity is grounded. */
|
3674
|
-
get isGrounded(): boolean;
|
3675
|
-
/** Whether the entity is on a platform, a platform is any entity with a kinematic rigid body. */
|
3676
|
-
get isOnPlatform(): boolean;
|
3677
|
-
/** The platform the entity is on, if any. */
|
3678
|
-
get platform(): Entity | undefined;
|
3679
|
-
/**
|
3680
|
-
* Called when the controller is attached to an entity.
|
3681
|
-
* @param entity - The entity to attach the controller to.
|
3682
|
-
*/
|
3683
|
-
attach(entity: Entity): void;
|
3684
|
-
/**
|
3685
|
-
* Called when the controlled entity is spawned.
|
3686
|
-
* In PlayerEntityController, this function is used to create
|
3687
|
-
* the colliders for the entity for wall and ground detection.
|
3688
|
-
* @param entity - The entity that is spawned.
|
3689
|
-
*/
|
3690
|
-
spawn(entity: Entity): void;
|
3691
|
-
/**
|
3692
|
-
* Ticks the player movement for the entity controller,
|
3693
|
-
* overriding the default implementation. If the entity to tick
|
3694
|
-
* is a child entity, only the event will be emitted but the default
|
3695
|
-
* movement logic will not be applied.
|
3696
|
-
*
|
3697
|
-
* @param entity - The entity to tick.
|
3698
|
-
* @param input - The current input state of the player.
|
3699
|
-
* @param cameraOrientation - The current camera orientation state of the player.
|
3700
|
-
* @param deltaTimeMs - The delta time in milliseconds since the last tick.
|
3701
|
-
*/
|
3702
|
-
tickWithPlayerInput(entity: PlayerEntity, input: PlayerInput, cameraOrientation: PlayerCameraOrientation, deltaTimeMs: number): void;
|
3703
|
-
}
|
3704
|
-
|
3705
|
-
/** Options for creating a PlayerEntityController instance. @public */
|
3706
|
-
export declare interface PlayerEntityControllerOptions {
|
3707
|
-
/** Whether to automatically cancel left click input after first processed tick, defaults to true. */
|
3708
|
-
autoCancelMouseLeftClick?: boolean;
|
3709
|
-
/** A function allowing custom logic to determine if the entity can jump. */
|
3710
|
-
canJump?: () => boolean;
|
3711
|
-
/** A function allowing custom logic to determine if the entity can walk. */
|
3712
|
-
canWalk?: () => boolean;
|
3713
|
-
/** A function allowing custom logic to determine if the entity can run. */
|
3714
|
-
canRun?: () => boolean;
|
3715
|
-
/** Overrides the animation(s) that will play when the entity is idle. */
|
3716
|
-
idleLoopedAnimations?: string[];
|
3717
|
-
/** Overrides the animation(s) that will play when the entity interacts (left click) */
|
3718
|
-
interactOneshotAnimations?: string[];
|
3719
|
-
/** Overrides the animation(s) that will play when the entity is jumping. */
|
3720
|
-
jumpOneshotAnimations?: string[];
|
3721
|
-
/** The upward velocity applied to the entity when it jumps. */
|
3722
|
-
jumpVelocity?: number;
|
3723
|
-
/** The normalized horizontal velocity applied to the entity when it runs. */
|
3724
|
-
runVelocity?: number;
|
3725
|
-
/** Overrides the animation(s) that will play when the entity is running. */
|
3726
|
-
runLoopedAnimations?: string[];
|
3727
|
-
/** Whether the entity sticks to platforms, defaults to true. */
|
3728
|
-
sticksToPlatforms?: boolean;
|
3729
|
-
/** Overrides the animation(s) that will play when the entity is walking. */
|
3730
|
-
walkLoopedAnimations?: string[];
|
3731
|
-
/** The normalized horizontal velocity applied to the entity when it walks. */
|
3732
|
-
walkVelocity?: number;
|
3733
|
-
}
|
3734
|
-
|
3735
3818
|
/** Options for creating a PlayerEntity instance. @public */
|
3736
3819
|
export declare type PlayerEntityOptions = {
|
3737
3820
|
/** The player the player entity is assigned to. */
|
@@ -5514,6 +5597,13 @@ export declare type WaypointMoveCompleteCallback = (waypoint: Vector3Like, waypo
|
|
5514
5597
|
*/
|
5515
5598
|
export declare type WaypointMoveSkippedCallback = (waypoint: Vector3Like, waypointIndex: number) => void;
|
5516
5599
|
|
5600
|
+
/** The options for a wedge collider. @public */
|
5601
|
+
export declare interface WedgeColliderOptions extends BaseColliderOptions {
|
5602
|
+
shape: ColliderShape.WEDGE;
|
5603
|
+
/** The extents of the wedge collider, defining full width (x), height (y), and length (z). */
|
5604
|
+
extents?: Vector3Like;
|
5605
|
+
}
|
5606
|
+
|
5517
5607
|
/**
|
5518
5608
|
* Represents a world in the game server.
|
5519
5609
|
*
|