Photon Fusion 2.1.1

Simulation.AreaOfInterestState Struct Reference

Area of Interest Definition. More...

Public Member Functions

 AreaOfInterestState (InterestManagementConfig config)
 Create a new instance of the AreaOfInterestState struct.
int GetCellSize ()
 Get the size of each cell in the AOI grid.
void SphereToCells (Vector3 position, float radius, HashSet< int > cells)
 Convert a sphere into a set of AOI cells. The conversion does not use a sphere but all cells that are inside cube centered at the position with edgeSize = radius * 2.
int ToCell (int x, int y, int z)
 Convert a cell coordinate into the respective cell index.
int ToCell (Vector3 position)
 Convert a position into the respective cell index.
Vector3 ToCellCenter (int index)
 Convert a cell index into the respective cell center position.

Public Attributes

int x
 Get the size of the AOI grid.

Properties

int MaxSharedRadius [get]
 The maximum radius supported for the player interest area in shared mode based on the current cell size. The area is a cube not a sphere. The radius is half the size of the cube's edges.

Detailed Description

Area of Interest Definition.

Constructor & Destructor Documentation

◆ AreaOfInterestState()

AreaOfInterestState ( InterestManagementConfig config)

Create a new instance of the AreaOfInterestState struct.

Parameters
configThe config to initialize.

Member Function Documentation

◆ GetCellSize()

int GetCellSize ( )

Get the size of each cell in the AOI grid.

Returns
The size of each cell in the AOI grid.

◆ SphereToCells()

void SphereToCells ( Vector3 position,
float radius,
HashSet< int > cells )

Convert a sphere into a set of AOI cells. The conversion does not use a sphere but all cells that are inside cube centered at the position with edgeSize = radius * 2.

Parameters
positionSphere center
radiusSphere radius. Max allowed radius is MaxSharedRadius
cellsResulting set of cells

◆ ToCell() [1/2]

int ToCell ( int x,
int y,
int z )

Convert a cell coordinate into the respective cell index.

Parameters
xX coordinate
yY coordinate
zZ coordinate
Returns
Cell index

◆ ToCell() [2/2]

int ToCell ( Vector3 position)

Convert a position into the respective cell index.

Parameters
positionPosition
Returns
Cell index

◆ ToCellCenter()

Vector3 ToCellCenter ( int index)

Convert a cell index into the respective cell center position.

Parameters
indexCell index
Returns
Cell center position

Member Data Documentation

◆ x

int x

Get the size of the AOI grid.

Clamp cell coordinates to the valid range.

Converts a cell index into its corresponding cell coordinates.

Convert a position into the respective cell coordinate.

Returns
The size of the AOI grid.
Parameters
positionPosition
Returns
Cell coordinate
Parameters
indexThe index of the cell to be converted.
Returns
A tuple containing the x, y, and z coordinates of the cell.
Parameters
xX coordinate
yY coordinate
zZ coordinate
Returns
Clamped cell coordinates