provides static methods to create and manipulate paths. below is an overview of methods provided by this class
for performance reasons, most of the time the same PathPosition instance is returned by PathIterator's. so if you want to need that value later store it in your own instance.
Nested Class Summary |
||
static interface |
Paths.Condition used to check if a certain condition is met. |
|
static class |
Paths.Wrapper utility class to wrap another PathIterator which delegates calls to
wrapped one. |
Field Summary |
||
static short |
ANIMATE_FALLDOWN animate falling down |
|
static short |
ANIMATE_FORWARD animate forward step |
|
static short |
ANIMATE_NONE no animation |
|
static short |
ANIMATE_TURN_LEFT animate turn left step |
|
static short |
ANIMATE_TURN_RIGHT animate turn right step |
|
static boolean |
PORTAL_EXITS_CREATE exit points through regular portals are generated |
|
static boolean |
PORTAL_EXITS_DONT_CREATE exit points through regular portals arent generated |
Method Summary |
||
static PathIterator |
acceleratedSegment(SimpleVector direction, SimpleVector from, SimpleVector to, short animation, float v0, float a) creates a PathIterator which moves over a straight line with accelaration. |
|
static PathIterator |
conditionalSegment(PathPosition pathPosition, Paths.Condition condition) creates a conditional PathIterator. |
|
static PathIterator |
curvedPath(Land.Point first, AStar.Path path, Land.Point last, SimpleVector currentDirection, SimpleVector lastDirection, PortalPasser portalPasser) creates a curved path which consists bezier curves and straight lines where possible. |
|
static PathIterator |
curvedSegment(SimpleVector p1, SimpleVector cp1, SimpleVector cp2, SimpleVector p2, float velocity, short animation) returns a PathIterator which follows a cubic bezier curve at constant speed. |
|
static PathIterator |
curvedSegment(Land.Point p1, Land.Point cp1, Land.Point cp2, Land.Point p2, float gridVelocity, short animation) returns a PathIterator which follows a cubic bezier curve at constant speed
all four points must be in same sector. |
|
static PathIterator |
linearPath(Land.Point first, AStar.Path path, Land.Point last, SimpleVector currentDirection, PortalPasser portalPasser) creates a linear path which consists of straight lines and turns at corners of lines. |
|
static PathIterator |
linearSegment(SimpleVector direction, SimpleVector from, SimpleVector to, float velocity, short animation) returns a PathIterator which goes linearly between given points. |
|
static PathIterator |
linearSegment(SimpleVector direction, Land.Point from, Land.Point to, float gridVelocity, short animation) returns a PathIterator which goes linearly between given points. |
|
static PathIterator |
||
static PathIterator |
||
static List<Land.Point> |
pathPoints(Land.Point first, AStar.Path path, Land.Point last, boolean createPortalExits) creates a list of points to follow the given path. |
|
static PathIterator |
turnSegment(SimpleVector from, SimpleVector to, SimpleVector location, float turnVelocity) creates a PathIterator which horizontally (around y axis) turns at given location. |
creates a list of points to follow the given path. the created points (other than portal exits) marks the corners to which the unit can go straight.
for non-regular portals always there are two succesive points on result regardless of createPortalExits variable. for regular portals exit points are created as follows:
creates a linear path which consists of straight lines and turns at corners of lines. move and turn speed is taken from PathContext encapsulated in path. the returned path will try to stay away from corners and sides by PathContext.distanceToEdges. note this may not always possible if very small sectors are on the way
note here straight means straight from top view, elevations are calculated along the path so the unit can nicely follow the terrain.
creates a curved path which consists bezier curves and straight lines where possible. move speed is taken from PathContext encapsulated in path. curvature is defined by PathContext.distanceToEdges
the returned path follows the curve at constant speed no matter what the curvature is. this is done by internally accumulating small curve segments and hence is somehow expensive. to reduce cost straight lines are used whereever possible. elevations are calculated along the path so the unit can nicely follow the terrain.
note, the returned path is guaranteed to stay in sectors which the original path goes through. but if very small sectors are on the way distanceToEdges may not be honored
also note, specifying a current and last direction which is just (or almost) the opposite to direction of next/previous segment may result in very ugly turns. this method doesnt make any attempt to fix such case. if required one may explicitly create a turn or curved segment and merge it with the returned path