Options
All
  • Public
  • Public/Protected
  • All
Menu

This class implements the logic to handle tracking position of players from the point of view of a given player.

Hierarchy

  • RelativePositionManager
    • PlayerPositionManager

Index

Constructors

Properties

event: Event

the event connected to this object

game: Game

the game connected to this object

leftTeam: boolean

If the event is from the team that defends the left side of the field

opponents: PlayerGroup

Positions of all the opponents of the team associated with the event

state: GameState

The tracking position of the players (got from the event)

teammates: PlayerGroup

Positions of all the teammates of the team associated with the event

Methods

  • opponentsAheadPosition(coordinate: number): PlayerGroup
  • Return a PlayerGroup of opponents AHEAD a given field X position in percentage. NB: those are opponents coordinates if you specify for instance 50 it means "opponents on the attacking half of the pitch"

    Parameters

    • coordinate: number

      X coordinate of the field in percentage (0 friendly goal, 100 opponent goal)

    Returns PlayerGroup

  • Returns the players of the team against the one of the event that are behind the ball (in a more defensive position)

    Returns PlayerGroup

    an array of players of the event player team that are currently behind the ball

  • opponentsBehindPosition(coordinate: number): PlayerGroup
  • Return a PlayerGroup of opponents behind a given field X position in percentage. NB: those are opponents coordinates if you specify for instance 50 it means "opponents on their defending half of the pitch"

    Parameters

    • coordinate: number

      X coordinate of the field in percentage (0 friendly goal, 100 opponent goal)

    Returns PlayerGroup

  • opponentsBehindZone(playersRole: string): Zone
  • Get the polygon shape of the zone behind opponents of a specific role.

    Parameters

    • playersRole: string

      role of the opponents to consider (e.g., 'Defender').

    Returns Zone

    the polygon shape of the zone behind the opponents as a Zone object.

  • Returns an array of opponents in the specified zone.

    Parameters

    • zone: Zone

      zone of the field

    Returns PlayerGroup

  • opponentsShape(playersToInclude: PlayersToInclude): Zone
  • Get the polygon shape of opponents (excluding Goalkeeper).

    Parameters

    • playersToInclude: PlayersToInclude

      players to use as the vertices of the polygon, wheter all the players or only the external ones (Convex Hull).

    Returns Zone

    the polygon shape of the PlayerGroup as a Zone.

  • Opponents with a distance of not more than the specified amount of meters

    Parameters

    • distance: number

      maximum distance in meters

    Returns PlayerGroup

  • opponentsWithDistanceFrom(x: number, y: number, distance: number): PlayerGroup
  • Returns the opponents with a given distance from the specified position.

    The position is always in LTR coordinate system, with 0, 0 as the lower left corner of the field.

    Parameters

    • x: number

      x position in percentage of the field length where 0 is the friendly goal and 100 the opponent goal

    • y: number

      y position in percentage of the field width where 0 is the side of the field nearest to the broadcast camera

    • distance: number

      maximum distance from the given point in meters

    Returns PlayerGroup

  • Returns an array of players (both teammates and opponents) in the specified zone.

    Parameters

    • zone: Zone

      zone of the field

    Returns PlayerGroup

  • Players (both teammates and opponents) with a distance of not more than the specified amount of meters

    Parameters

    • distance: number

      maximum distance in meters

    Returns PlayerGroup

  • playersWithDistanceFrom(x: number, y: number, distance: number): PlayerGroup
  • Returns the players from both team with a given distance from the specified position.

    The position is always in LTR coordinate system, with 0, 0 as the lower left corner of the field.

    Parameters

    • x: number

      x position in percentage of the field length where 0 is the friendly goal and 100 the opponent goal

    • y: number

      y position in percentage of the field width where 0 is the side of the field nearest to the broadcast camera

    • distance: number

      maximum distance from the given point in meters

    Returns PlayerGroup

  • teammatesAheadPosition(coordinate: number): PlayerGroup
  • Return a PlayerGroup of teammates AHEAD a given field X position in percentage. Example: passing 66 as coordinate will return the group of teammates in the attacking third.

    Parameters

    • coordinate: number

      X coordinate of the field in percentage (0 friendly goal, 100 opponent goal)

    Returns PlayerGroup

  • Returns the players of the team that performed the specified event that are behind the ball (in a more defensive position)

    Returns PlayerGroup

    an array of players of the event player team that are currently behind the ball

  • teammatesBehindPosition(coordinate: number): PlayerGroup
  • Return a PlayerGroup of teammates behind a given field X position in percentage. Example: passing 33 as coordinate will return the group of teammates in the defending third.

    Parameters

    • coordinate: number

      X coordinate of the field in percentage (0 friendly goal, 100 opponent goal)

    Returns PlayerGroup

  • teammatesBehindZone(playersRole: string): Zone
  • Get the polygon shape of the zone behind teammates of a specific role.

    Parameters

    • playersRole: string

      role of the teammates to consider (e.g., 'Defender').

    Returns Zone

    the polygon shape of the zone behind the teammates as a Zone object.

  • Return an array of teammates in the specified zone.

    Parameters

    • zone: Zone

      zone of the field

    Returns PlayerGroup

  • teammatesShape(playersToInclude: PlayersToInclude): Zone
  • Get the polygon shape of teammates (excluding Goalkeeper).

    Parameters

    • playersToInclude: PlayersToInclude

      players to use as the vertices of the polygon, wheter all the players or only the external ones (Convex Hull).

    Returns Zone

    the polygon shape of the PlayerGroup as a Zone.

  • Teammates with a distance of not more than the specified amount of meters

    Parameters

    • distance: number

      maximum distance in meters

    Returns PlayerGroup

  • teammatesWithDistanceFrom(x: number, y: number, distance: number): PlayerGroup
  • Returns the teammates with a given distance from the specified position.

    The position is always in LTR coordinate system, with 0, 0 as the lower left corner of the field.

    Parameters

    • x: number

      x position in percentage of the field length where 0 is the friendly goal and 100 the opponent goal

    • y: number

      y position in percentage of the field width where 0 is the side of the field nearest to the broadcast camera

    • distance: number

      maximum distance from the given point in meters

    Returns PlayerGroup