Terrain Engine 2D  1.10
A 2D Block Engine
TerrainEngine2D.ColliderGenerator Class Reference

Generates collider paths for the PolygonCollider2D on the chunk More...

Inheritance diagram for TerrainEngine2D.ColliderGenerator:

Public Member Functions

void Initialize (int chunkSize)
 Initializes the collider path lists and arrays with the size of the chunk More...
 
void GenColliderPaths (int x, int y, bool newPath, Vector2 prevPoint)
 Recursively generates collider paths by traversing along the edges of the blocks in the chunk. More...
 
void UpdateCollider ()
 Updates the PolygonCollider2D with the generated path list More...
 

Detailed Description

Generates collider paths for the PolygonCollider2D on the chunk

Member Function Documentation

◆ GenColliderPaths()

void TerrainEngine2D.ColliderGenerator.GenColliderPaths ( int  x,
int  y,
bool  newPath,
Vector2  prevPoint 
)

Recursively generates collider paths by traversing along the edges of the blocks in the chunk.

Uses bitmasking and edge detection to determine the proper route

Parameters
xX coordinate of the collider point
yY coordinate of the collider point
newPathSet true if generating a new path
prevPointThe point previously checked

◆ Initialize()

void TerrainEngine2D.ColliderGenerator.Initialize ( int  chunkSize)

Initializes the collider path lists and arrays with the size of the chunk

◆ UpdateCollider()

void TerrainEngine2D.ColliderGenerator.UpdateCollider ( )

Updates the PolygonCollider2D with the generated path list


The documentation for this class was generated from the following file: