Interface ILocalPlayerEvents

Define events supported by ILocalPlayer and their corresponding parameters.

interface ILocalPlayerEvents {
    collisionend: ((other: Entity) => void);
    collisionstart: ((result: ContactResult) => void);
    contact: ((result: ContactResult) => void);
    infiniteFalling: (() => void);
    jump:end: (() => void);
    jump:start: (() => void);
    landed: ((position: Vec3) => void);
    move:horizontal: ((currentState: HorizontalTypes, prevState: HorizontalTypes) => void);
    move:vertical: ((currentState: VerticalTypes, prevState: VerticalTypes) => void);
    player:ready: ((entity: Entity) => void);
    respawned: ((position: Vec3) => void);
    xr:teleport: (() => void);
    xr:turning: (() => void);
}

Hierarchy (view full)

Properties

collisionend: ((other: Entity) => void)

Triggered when the player stops touching another rigid body.

Type declaration

    • (other): void
    • Parameters

      • other: Entity

        The rigid body entity that the player is no longer in contact with.

      Returns void

collisionstart: ((result: ContactResult) => void)

Triggered when the player starts touching another rigid body.

Type declaration

    • (result): void
    • Parameters

      • result: ContactResult

        Contains details of the contact between the player and the other rigid body.

      Returns void

contact: ((result: ContactResult) => void)

Triggered while the player is touching another rigid body.

Type declaration

    • (result): void
    • Parameters

      • result: ContactResult

        Contains details of the contact between the player and the other rigid body.

      Returns void

infiniteFalling: (() => void)

Triggered when the player's avatar is in an infinite fall state, typically used to check if the character is no longer in the scene.

jump:end: (() => void)

Triggered when the player's avatar lands.

jump:start: (() => void)

Triggered when the player's avatar jumps.

landed: ((position: Vec3) => void)

Triggered when the player's avatar lands in the scene, and returns the current coordinates.

Type declaration

    • (position): void
    • Parameters

      • position: Vec3

        Current coordinates.

      Returns void

move:horizontal: ((currentState: HorizontalTypes, prevState: HorizontalTypes) => void)

Trigger when the player’s avatar horizontal movement state changes.

Type declaration

    • (currentState, prevState): void
    • Parameters

      Returns void

move:vertical: ((currentState: VerticalTypes, prevState: VerticalTypes) => void)

Trigger when the player’s avatar vertical movement state changes.

Type declaration

    • (currentState, prevState): void
    • Parameters

      Returns void

player:ready: ((entity: Entity) => void)

Triggered when the player's initialization is complete.

Type declaration

    • (entity): void
    • Parameters

      • entity: Entity

        Player's entity

      Returns void

respawned: ((position: Vec3) => void)

Triggered when the player's avatar respawns, and returns the respawn point coordinates.

Type declaration

    • (position): void
    • Parameters

      • position: Vec3

        Respawn point coordinates.

      Returns void

xr:teleport: (() => void)

Trigger when the player’s avatar is in XR teleportation.

xr:turning: (() => void)

Trigger when the player’s avatar is in XR turning.