List<Vector2>[] calculatePlayerCollision(Vector2[] endPos,Vector2[] v)
{
List<Vector2>[] result = new List<Vector2>[2];
List<Vector2>[] nextResult = new List<Vector2>[2];
Vector2[] newV = new Vector2[2];
Vector2[] nextEndPos = new Vector2[2];
newV [1] = v [0];
newV [0] = v [1];
for (int i=0; i<2; i++) {
result[i] = new List<Vector2>();
// Going half the distance before collision
result [i].Add (v [i] / 2);
// Prepare for recursion
nextEndPos [i] = endPos [i] + newV [i];
}
nextResult = calculateCollision(nextEndPos,newV);
// Correct the first element
result [0].Add (v [0] / 2 + nextResult [0] [0]);
result [1].Add (v [1] / 2 + nextResult [1] [0]);
nextResult [0].RemoveAt (0);
nextResult [1].RemoveAt (0);
// Merge the lists
result = appendLists (result, nextResult);
return result;
}