Hi there,
I’m working on a simple formation system, and thus far I am very pleased with how it turned out.
However, now I would like to rotate all the Vectors around a pivot point, any ideas?
Currently I’m setting all the destinations through Vectors in a list with offsets to the point:
private List<Vector3> TwoLineFormation(Vector3 startPoint, float spacing, Vector3 direction)
{
List<Vector3> targetPosList = new List<Vector3>();
int count = selector.getSelectedNPCs().Count;
Debug.Log(count + " NPCs selected");
for (int i = 0; i < 2; i++)
{
for (int x = 0; x <= count / 2; x++)
{
targetPosList.Add(startPoint + new Vector3(spacing / 4, 0, (spacing * x) - (spacing / 2 * count / 2) - spacing / 2));
targetPosList.Add(startPoint + new Vector3(-spacing / 4, 0, (spacing * x + spacing / 2) -(spacing / 2 * count / 2) - spacing / 2));
}
}
return targetPosList;
}
As you see, I would like to use the unused variable direction for that purpose, but I’m quite unsure on how to do that.