1 package cz.cuni.amis.pogamut.udk.agent.navigation; 2 3 import cz.cuni.amis.pogamut.base.agent.navigation.IPathFuture; 4 import cz.cuni.amis.pogamut.base.agent.navigation.IPathPlanner; 5 import cz.cuni.amis.pogamut.base3d.worldview.object.ILocated; 6 import cz.cuni.amis.pogamut.udk.bot.impl.UDKBot; 7 8 /** 9 * Finds the shortest through internal A* algorithm in the UDK. The path info is send through GB2004 messages. 10 * <p><p> 11 * Returns {@link UDKAStarPathFuture} that contains the logic for obtaining the path from UDK (note that it takes 12 * some time then UDK sends you a path). 13 * <p><p> 14 * <b>IMPORTANT:</b> Due to restrictions of the UnrealScript path planner this implementation returns only paths of maximal length 16. 15 * Therefore returned path may end on the half way trough. Therefore, whenever the {@link IPathExecutor} reports that 16 * the bot has reached its target, you should compare bot's current position and the {@link UDKAStarPathFuture#getPathTo()}. 17 * 18 * @author Ik 19 * @author Jimmy 20 */ 21 public class UDKAStarPathPlanner implements IPathPlanner<ILocated> { 22 23 private UDKBot bot; 24 25 public UDKAStarPathPlanner(UDKBot bot) { 26 this.bot = bot; 27 } 28 29 @Override 30 public IPathFuture<ILocated> computePath(ILocated from, ILocated to) { 31 return new UDKAStarPathFuture(bot, from, to); 32 } 33 34 }