Skip to content

Tech Tree - Find "true" center of parents #72

@valkyrienyanko

Description

@valkyrienyanko

image

Notice how nodes X, D, and E are centered perfectly but node B is not quite "centered". Rather B is leaning more towards nodes E, F, C instead of nodes W, D. This is because of how the parent node center is calculated. The sum of the y positions are added together and divided by the number of nodes giving the "averaged weighted center".

This could be the way to represent the tech tree nodes however I would like to see how it looks if every parents center was calculated based on the top child node + the bottom child node y position divided by 2 to get the "true" center.

Perhaps a boolean could be added to switch between the 2 styles to see which ever looks better.

// Find weighted middle y pos based off children
for (int i = 0; i < data.Unlocks.Length; i++)
{
yPos += ResearchData[data.Unlocks[i]].Position.y;
}
yPos /= data.Unlocks.Length;

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions