Calculating agent and goal positions