skeldjs
    Preparing search index...

    Class CustomNetworkTransform<RoomType>

    Represents player component for networking movement.

    See CustomNetworkTransformEvents for events to listen to.

    Type Parameters

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    components: NetworkedObject<RoomType, any>[]
    dirtyBit: number = 0

    The dirty state of this component.

    flags: number

    Flags for this object, see SpawnFlag.

    netId: number

    The net ID of this component.

    ownerId: number

    The ID of the owner of this component.

    player: Player<RoomType>

    The player that this component belongs to.

    position: Vector2

    The current position of the player.

    room: RoomType

    The room that this component belongs to.

    seqId: number

    The current sequence ID.

    spawnType: SpawnType

    The type of object that this component belongs to.

    Accessors

    Methods

    • Instantly snap to a position without lerping.

      Parameters

      • position: Vector2

        The position to snap to.

      • Optionalrpc: boolean

      Returns Promise<void>

      // Instantly teleport to wherever the host moves.
      host.transform.on("player.move", ev => {
      client.me.transform.snapTo(ev.position);
      });
    • Instantly snap to a position without lerping.

      Parameters

      • x: number

        The X position to snap to.

      • y: number

        The Y position to snap to.

      • Optionalrpc: boolean

      Returns Promise<void>

      // Instantly teleport to wherever the host moves.
      host.transform.on("player.move", ev => {
      client.me.transform.snapTo(ev.position.x, ev.position.y);
      });